--- rxvt-unicode/src/menubar.C 2004/04/02 00:51:10 1.15 +++ rxvt-unicode/src/menubar.C 2006/01/04 04:42:45 1.30 @@ -1,8 +1,9 @@ /*--------------------------------*-C-*---------------------------------* - * File: menubar.c + * File: menubar.C *----------------------------------------------------------------------* * * Copyright (c) 1997,1998 mj olesen + * Copyright (c) 2004 Marc Lehmann * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,15 +31,14 @@ #ifdef MENUBAR #include "version.h" #include "menubar.h" -#include "menubar.intpro" /* PROTOS for internal routines */ #define Menu_PixelWidth(menu) \ - (2 * SHADOW + Width2Pixel ((menu)->width + 3 * HSPACE)) + (2 * MENU_SHADOW + Width2Pixel ((menu)->width + 3 * HSPACE)) static const struct { - const char name; /* (l)eft, (u)p, (d)own, (r)ight */ - const unsigned char str[5]; /* str[0] = STRLEN (str+1) */ + const char name; /* (l)eft, (u)p, (d)own, (r)ight */ + const char str[5]; /* str[0] = strlen (str+1) */ } Arrows[NARROWS] = { { 'l', "\003\033[D" }, @@ -91,11 +91,11 @@ { 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)) + || !strcmp (name, item->name)) break; } return item; @@ -149,12 +149,12 @@ * 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, char *str) { unsigned int len; #if defined (DEBUG_MENU) || defined (DEBUG_MENUARROWS) - len = STRLEN (str); + len = strlen (str); fprintf (stderr, " (len %d) = %s\n", len, str); #else len = rxvt_Str_escaped ((char *)str); @@ -168,9 +168,9 @@ if (str[0] == '\0') { /* the functional equivalent: memmove (str, str+1, len); */ - unsigned char *dst = (str); - unsigned char *src = (str + 1); - unsigned char *end = (str + len); + char *dst = (str); + char *src = (str + 1); + char *end = (str + len); while (src <= end) *dst++ = *src++; @@ -179,6 +179,7 @@ if (str[0] != '\0') action->type = MenuTerminalAction; } + action->str = str; action->len = len; @@ -265,7 +266,7 @@ *cur, parse[NARROWS]; - MEMSET (parse, 0, sizeof (parse)); + memset (parse, 0, sizeof (parse)); /* fprintf (stderr, "add arrows = `%s'\n", string); */ for (p = string; p != NULL && *p; string = p) @@ -296,7 +297,7 @@ if (cur == &end) { - p = STRCHR (string, '\0'); + p = strchr (string, '\0'); } else { @@ -304,7 +305,7 @@ while (1) { - p = STRCHR (next, '<'); + p = strchr (next, '<'); if (p != NULL) { if (p[1] && p[2] == '>') @@ -314,7 +315,7 @@ else { if (beg.str == NULL) /* no end needed */ - p = STRCHR (next, '\0'); + p = strchr (next, '\0'); break; } next = (p + 1); @@ -351,26 +352,26 @@ for (i = 0; i < NARROWS; i++) { - unsigned char *str; - unsigned int len; + char *str; + unsigned int len; if (!parse[i].len) continue; - str = (unsigned char *) rxvt_malloc (parse[i].len + xtra_len + 1); + str = (char *)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'; @@ -434,9 +435,9 @@ item->len2 = 0; item->name2 = NULL; - len = STRLEN (name); + len = strlen (name); item->name = (char *)rxvt_malloc (len + 1); - STRCPY (item->name, name); + strcpy (item->name, name); if (name[0] == '.' && name[1] != '.') len = 0; /* hidden menu name */ item->len = len; @@ -458,18 +459,18 @@ Item_Found: if (name2 != NULL && item->name2 == NULL) { - len = STRLEN (name2); + len = strlen (name2); if (len == 0) item->name2 = NULL; else { item->name2 = (char *)rxvt_malloc (len + 1); - STRCPY (item->name2, name2); + strcpy (item->name2, name2); } item->len2 = len; } item->entry.type = MenuLabel; - len = STRLEN (action); + len = strlen (action); if (len == 0 && item->name2 != NULL) { @@ -478,9 +479,9 @@ } if (len) { - unsigned char *str = (unsigned char *)rxvt_malloc (len + 1); + char *str = (char *)rxvt_malloc (len + 1); - STRCPY (str, action); + strcpy (str, action); if (rxvt_action_type (& (item->entry.action), str) < 0) free (str); @@ -510,11 +511,11 @@ 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 == '/') @@ -527,17 +528,17 @@ *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; @@ -556,9 +557,9 @@ } } - if (!STRCMP (path, DOTS)) + if (!strcmp (path, DOTS)) { - path += STRLEN (DOTS); + path += strlen (DOTS); if (*menu != NULL) *menu = (*menu)->parent; return path; @@ -568,7 +569,7 @@ if (*menu == NULL) { for (m = CurrentBar->tail; m != NULL; m = m->prev) - if (!STRCMP (path, m->name)) + if (!strcmp (path, m->name)) break; } else @@ -577,7 +578,7 @@ 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; @@ -588,7 +589,7 @@ if (m != NULL) { *menu = m; - path += STRLEN (path); + path += strlen (path); } return path; @@ -672,7 +673,7 @@ assert (CurrentBar != NULL); #endif - if (STRCHR (path, '/') != NULL) + if (strchr (path, '/') != NULL) { char *p; @@ -682,7 +683,7 @@ path++; parent = NULL; } - while ((p = STRCHR (path, '/')) != NULL) + while ((p = strchr (path, '/')) != NULL) { p[0] = '\0'; if (path[0] == '\0') @@ -692,10 +693,10 @@ 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 */ @@ -703,9 +704,9 @@ menu->width = 0; menu->parent = parent; - menu->len = STRLEN (path); + menu->len = strlen (path); menu->name = (char *)rxvt_malloc ((menu->len + 1)); - STRCPY (menu->name, path); + strcpy (menu->name, path); /* initialize head/tail */ menu->head = menu->tail = NULL; @@ -755,10 +756,10 @@ x = Width2Pixel (x); len = Width2Pixel (len + HSPACE); - if (x >= TermWin.width) + if (x >= width) return; - else if (x + len >= TermWin.width) - len = (TermWin_TotalWidth () - x); + else if (x + len >= width) + len = (this->width - x); #ifdef MENUBAR_SHADOW_IN state = -state; @@ -806,10 +807,10 @@ break; /* neutral */ } - w = Height2Pixel (1) - 2 * SHADOW; + w = Height2Pixel (1) - 2 * MENU_SHADOW; - x -= SHADOW + (3 * w / 2); - y += SHADOW * 3; + x -= MENU_SHADOW + (3 * w / 2); + y += MENU_SHADOW * 3; rxvt_Draw_Triangle (display->display, ActiveMenu->win, top, bot, x, y, w, 'r'); } @@ -838,9 +839,9 @@ } rxvt_Draw_Shadow (display->display, ActiveMenu->win, top, bot, - SHADOW + 0, SHADOW + y, - ActiveMenu->w - 2 * (SHADOW), - HEIGHT_TEXT + 2 * SHADOW); + MENU_SHADOW + 0, MENU_SHADOW + y, + ActiveMenu->w - 2 * (MENU_SHADOW), + HEIGHT_TEXT + 2 * MENU_SHADOW); XFlush (display->display); } @@ -944,24 +945,24 @@ ActiveMenu->y = 1; ActiveMenu->w = Menu_PixelWidth (ActiveMenu); - if ((x + ActiveMenu->w) >= TermWin.width) - x = (TermWin_TotalWidth () - ActiveMenu->w); + if ((x + ActiveMenu->w) >= width) + x = (this->width - ActiveMenu->w); /* find the height */ for (h = 0, item = ActiveMenu->head; item != NULL; item = item->next) h += isSeparator (item->name) ? HEIGHT_SEPARATOR - : HEIGHT_TEXT + 2 * SHADOW; - ActiveMenu->h = h + 2 * SHADOW; + : HEIGHT_TEXT + 2 * MENU_SHADOW; + ActiveMenu->h = h + 2 * MENU_SHADOW; } if (ActiveMenu->win == None) { - ActiveMenu->win = XCreateSimpleWindow (display->display, TermWin.vt, - x, ActiveMenu->y, - ActiveMenu->w, ActiveMenu->h, - 0, - PixColors[Color_fg], - PixColors[Color_scroll]); + ActiveMenu->win = XCreateSimpleWindow (display->display, vt, + x, ActiveMenu->y, + ActiveMenu->w, ActiveMenu->h, + 0, + pix_colors[Color_fg], + pix_colors[Color_scroll]); ActiveMenu->drawable = new rxvt_drawable (display, ActiveMenu->win); XMapWindow (display->display, ActiveMenu->win); } @@ -977,16 +978,16 @@ for (y = 0, item = ActiveMenu->head; item != NULL; item = item->next) { - const int xoff = (SHADOW + Width2Pixel (HSPACE) / 2); + const int xoff = (MENU_SHADOW + Width2Pixel (HSPACE) / 2); register int h; GC gc = menubarGC; if (isSeparator (item->name)) { rxvt_Draw_Shadow (display->display, ActiveMenu->win, - topShadowGC, botShadowGC, - SHADOW, y + SHADOW + 1, - ActiveMenu->w - 2 * SHADOW, 0); + topShadowGC, botShadowGC, + MENU_SHADOW, y + MENU_SHADOW + 1, + ActiveMenu->w - 2 * MENU_SHADOW, 0); h = HEIGHT_SEPARATOR; } else @@ -1020,34 +1021,34 @@ /* find the height of this submenu */ for (h = 0, it = menu->head; it != NULL; it = it->next) h += isSeparator (it->name) ? HEIGHT_SEPARATOR - : HEIGHT_TEXT + 2 * SHADOW; - menu->h = h + 2 * SHADOW; + : HEIGHT_TEXT + 2 * MENU_SHADOW; + menu->h = h + 2 * MENU_SHADOW; /* ensure menu is in window limits */ - if ((x1 + menu->w) >= TermWin.width) - x1 = (TermWin_TotalWidth () - menu->w); + if ((x1 + menu->w) >= width) + x1 = (this->width - menu->w); - if ((y1 + menu->h) >= TermWin.height) - y1 = (TermWin_TotalHeight () - menu->h); + if ((y1 + menu->h) >= height) + y1 = (this->height - 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) - draw_string (*ActiveMenu->drawable, gc, TermWin.fontset, - xoff, 2 * SHADOW + y, name, len); + draw_string (*ActiveMenu->drawable, gc, fontset[0], + xoff, 2 * MENU_SHADOW + y, name, len); len = item->len2; name = item->name2; if (len && name) - draw_string (*ActiveMenu->drawable, gc, TermWin.fontset, - ActiveMenu->w - (xoff + Width2Pixel (xright)), 2 * SHADOW + y, name, len); + draw_string (*ActiveMenu->drawable, gc, fontset[0], + ActiveMenu->w - (xoff + Width2Pixel (xright)), 2 * MENU_SHADOW + y, name, len); - h = HEIGHT_TEXT + 2 * SHADOW; + h = HEIGHT_TEXT + 2 * MENU_SHADOW; } y += h; } @@ -1144,11 +1145,11 @@ 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"); @@ -1178,7 +1179,7 @@ /* allocate first one */ 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; @@ -1235,7 +1236,7 @@ } /* give menubar this name */ - STRNCPY (CurrentBar->name, name, MAXNAME); + strncpy (CurrentBar->name, name, MAXNAME); CurrentBar->name[MAXNAME - 1] = '\0'; return ret; @@ -1278,13 +1279,13 @@ CurrentBar = prev; } } - while (CurrentBar && !STRCMP (name, "*")); + while (CurrentBar && !strcmp (name, "*")); } void rxvt_action_decode (FILE *fp, action_t *act) { - unsigned char *str; + char *str; short len; if (act == NULL || (len = act->len) == 0 || (str = act->str) == NULL) @@ -1327,7 +1328,7 @@ */ while (len > 0) { - unsigned char ch = *str++; + char ch = *str++; switch (ch) { @@ -1348,7 +1349,7 @@ default: if (ch <= 31) fprintf (fp, "^%c", ('@' + ch)); - else if (ch > 127) + else if ((unsigned char)ch > 127) fprintf (fp, "\\%o", ch); else fprintf (fp, "%c", ch); @@ -1381,13 +1382,13 @@ 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)) + if (item->name2 != NULL && strlen (item->name2)) fprintf (fp, "{%s}", item->name2); fprintf (fp, "\t"); rxvt_action_decode (fp, & (item->entry.action)); @@ -1481,7 +1482,7 @@ #if (MENUBAR_MAX > 1) /* semi-colon delimited */ - if ((tag = STRCHR (filename, ';')) != NULL) + if ((tag = strchr (filename, ';')) != NULL) { tag++; if (*tag == '\0') @@ -1565,9 +1566,9 @@ } } } + /* * remove leading/trailing space - * and strip-off leading/trailing quotes * skip blank or comment lines */ rxvt_Str_trim (p); @@ -1631,7 +1632,7 @@ do { next++; - if ((next = STRCHR (next, ':')) == NULL) + if ((next = strchr (next, ':')) == NULL) return; /* parse error */ } while (next[1] != ']'); @@ -1641,7 +1642,7 @@ } else { - if ((next = STRCHR (next, ']')) == NULL) + if ((next = strchr (next, ']')) == NULL) return; /* parse error */ /* remove and skip ']' */ *next = '\0'; @@ -1659,20 +1660,20 @@ 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; @@ -1690,10 +1691,10 @@ { if (*str) { - name = (char *)rxvt_realloc (CurrentBar->title, STRLEN (str) + 1); + name = (char *)rxvt_realloc (CurrentBar->title, strlen (str) + 1); if (name != NULL) { - STRCPY (name, str); + strcpy (name, str); CurrentBar->title = name; } menubar_expose (); @@ -1748,7 +1749,7 @@ 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; @@ -1766,7 +1767,7 @@ fclose (fp); } } - else if (!STRCMP (str, "next")) + else if (!strcmp (str, "next")) { if (CurrentBar) { @@ -1774,7 +1775,7 @@ menu_readonly = 1; } } - else if (!STRCMP (str, "prev")) + else if (!strcmp (str, "prev")) { if (CurrentBar) { @@ -1782,7 +1783,7 @@ menu_readonly = 1; } } - else if (!STRCMP (str, "swap")) + else if (!strcmp (str, "swap")) { /* swap the top 2 menus */ if (CurrentBar) @@ -1841,8 +1842,8 @@ /* 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) @@ -1854,7 +1855,7 @@ if (str[1] == MENUITEM_BEG) { name2 = (str + 2); - str = STRCHR (name2, MENUITEM_END); + str = strchr (name2, MENUITEM_END); if (str == NULL) { @@ -1890,7 +1891,7 @@ int len; path = menu_find_base (& (BuildMenu), path); - len = STRLEN (path); + len = strlen (path); /* don't allow menus called `*' */ if (path[0] == '*') @@ -1898,7 +1899,7 @@ menu_clear (BuildMenu); break; } - else if (len >= 2 && !STRCMP ((path + len - 2), "/*")) + else if (len >= 2 && !strcmp ((path + len - 2), "/*")) { path[len - 2] = '\0'; } @@ -1907,12 +1908,12 @@ } if (name != NULL && name[0] != '\0') rxvt_menuitem_add (BuildMenu, - (STRCMP (name, SEPARATOR_NAME) ? name : ""), + (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; @@ -1925,7 +1926,7 @@ 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] == '*') @@ -1933,7 +1934,7 @@ menu_clear (menu); break; /* done */ } - else if (len >= 2 && !STRCMP (&path[len - 2], "/*")) + else if (len >= 2 && !strcmp (&path[len - 2], "/*")) { /* done */ break; @@ -1946,6 +1947,7 @@ else BuildMenu = menu; } + if (BuildMenu != NULL) { if (name == NULL || name[0] == '\0') @@ -1954,9 +1956,8 @@ { const char *n1; menuitem_t *item; - menu_t *BuildMenu = BuildMenu; - n1 = STRCMP (name, SEPARATOR_NAME) ? name : ""; + n1 = strcmp (name, SEPARATOR_NAME) ? name : ""; item = rxvt_menuitem_find (BuildMenu, n1); if (item != NULL && item->entry.type != MenuSubMenu) { @@ -1969,10 +1970,11 @@ { short l = item->len + item->len2; - MAX_IT (BuildMenu->width, l); + max_it (BuildMenu->width, l); } } } + menubar_expose (); } break; @@ -2017,7 +2019,7 @@ if (!name || name == Arrows[i].name) rxvt_Draw_Triangle (display->display, menuBar.win, top, bot, x, y, w, - Arrows[i].name); + Arrows[i].name); } XFlush (display->display); } @@ -2036,8 +2038,8 @@ /* Create the graphics context */ XGCValues gcvalue; - gcvalue.foreground = (XDEPTH <= 2 ? PixColors[Color_fg] - : PixColors[Color_Black]); + gcvalue.foreground = (display->depth <= 2 ? pix_colors[Color_fg] + : pix_colors[Color_Black]); menubarGC = XCreateGC (display->display, menuBar.win, GCForeground, &gcvalue); @@ -2060,35 +2062,34 @@ rxvt_print_menu_descendants (menu); #endif - if (x >= TermWin.ncol) - len = (TermWin.ncol - (menu->x + HSPACE)); + if (x >= ncol) + len = (ncol - (menu->x + HSPACE)); drawbox_menubar (menu->x, len, +1); - draw_string (*menuBar.drawable, menubarGC, TermWin.fontset, + draw_string (*menuBar.drawable, menubarGC, fontset[0], (Width2Pixel (menu->x) + Width2Pixel (HSPACE) / 2), - SHADOW, menu->name, len); + MENU_SHADOW, menu->name, len); - if (x >= TermWin.ncol) + if (x >= ncol) break; } } - drawbox_menubar (x, TermWin.ncol, (CurrentBar ? +1 : -1)); + drawbox_menubar (x, ncol, (CurrentBar ? +1 : -1)); /* add the menuBar title, if it exists and there's plenty of room */ Arrows_x = 0; - if (x < TermWin.ncol) + if (x < ncol) { const char *str; - int ncol; unsigned int len; char title[256]; - ncol = (int)TermWin.ncol; if (x < (ncol - (NARROWS + 1))) { ncol -= (NARROWS + 1); Arrows_x = Width2Pixel (ncol); } + draw_Arrows (0, +1); str = (CurrentBar @@ -2127,9 +2128,9 @@ ncol -= (x + len + HSPACE); if (len > 0 && ncol >= 0) - draw_string (*menuBar.drawable, menubarGC, TermWin.fontset, + draw_string (*menuBar.drawable, menubarGC, fontset[0], Width2Pixel (x) + Width2Pixel (ncol + HSPACE) / 2, - SHADOW, title, len); + MENU_SHADOW, title, len); } } @@ -2184,12 +2185,12 @@ } /* determine the menu item corresponding to the Y index */ - y = SHADOW; - if (ev.x >= 0 && ev.x <= (ActiveMenu->w - SHADOW)) + y = MENU_SHADOW; + if (ev.x >= 0 && ev.x <= (ActiveMenu->w - MENU_SHADOW)) { for (item = ActiveMenu->head; item != NULL; item = item->next) { - int h = HEIGHT_TEXT + 2 * SHADOW; + int h = HEIGHT_TEXT + 2 * MENU_SHADOW; if (isSeparator (item->name)) h = HEIGHT_SEPARATOR; @@ -2207,7 +2208,7 @@ } thisitem = item; - this_y = y - SHADOW; + this_y = y - MENU_SHADOW; /* erase the last item */ if (ActiveMenu->item != NULL) @@ -2230,7 +2231,7 @@ break; } else - h = HEIGHT_TEXT + 2 * SHADOW; + h = HEIGHT_TEXT + 2 * MENU_SHADOW; y += h; } @@ -2250,20 +2251,7 @@ case MenuAction: case MenuTerminalAction: drawbox_menuitem (this_y, -1); -#ifdef HAVE_NANOSLEEP - struct timespec rqt; - - rqt.tv_sec = 0; - rqt.tv_nsec = MENU_DELAY_USEC * 1000; - 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); -#endif + rxvt_usleep (MENU_DELAY_USEC); /* remove menu before sending keys to the application */ menu_hide_all (); #ifndef DEBUG_MENU @@ -2351,23 +2339,7 @@ + (Width2Pixel (4 * i + i + 4)) / 4)) { draw_Arrows (Arrows[i].name, -1); - { -#ifdef HAVE_NANOSLEEP - struct timespec rqt; - - rqt.tv_sec = 0; - rqt.tv_nsec = MENU_DELAY_USEC * 1000; - 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); -#endif - - } + rxvt_usleep (MENU_DELAY_USEC); draw_Arrows (Arrows[i].name, +1); #ifdef DEBUG_MENUARROWS fprintf (stderr, "'%c': ", Arrows[i].name); @@ -2434,8 +2406,8 @@ break; case MotionNotify: - while (XCheckTypedWindowEvent (display->display, TermWin.parent[0], - MotionNotify, (XEvent *)&ev)) ; + while (XCheckTypedWindowEvent (display->display, parent[0], + MotionNotify, (XEvent *)&ev)); if (ActiveMenu) while (menu_select (ev)) ;