--- rxvt-unicode/src/menubar.C 2004/08/15 21:55:45 1.20 +++ rxvt-unicode/src/menubar.C 2005/12/18 00:59:42 1.26 @@ -755,9 +755,9 @@ x = Width2Pixel (x); len = Width2Pixel (len + HSPACE); - if (x >= TermWin.width) + if (x >= width) return; - else if (x + len >= TermWin.width) + else if (x + len >= width) len = (TermWin_TotalWidth () - x); #ifdef MENUBAR_SHADOW_IN @@ -944,7 +944,7 @@ ActiveMenu->y = 1; ActiveMenu->w = Menu_PixelWidth (ActiveMenu); - if ((x + ActiveMenu->w) >= TermWin.width) + if ((x + ActiveMenu->w) >= width) x = (TermWin_TotalWidth () - ActiveMenu->w); /* find the height */ @@ -956,12 +956,12 @@ if (ActiveMenu->win == None) { - ActiveMenu->win = XCreateSimpleWindow (display->display, TermWin.vt, - x, ActiveMenu->y, - ActiveMenu->w, ActiveMenu->h, - 0, - pix_colors[Color_fg], - pix_colors[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); } @@ -984,9 +984,9 @@ if (isSeparator (item->name)) { rxvt_Draw_Shadow (display->display, ActiveMenu->win, - topShadowGC, botShadowGC, - SHADOW, y + SHADOW + 1, - ActiveMenu->w - 2 * SHADOW, 0); + topShadowGC, botShadowGC, + SHADOW, y + SHADOW + 1, + ActiveMenu->w - 2 * SHADOW, 0); h = HEIGHT_SEPARATOR; } else @@ -1024,10 +1024,10 @@ menu->h = h + 2 * SHADOW; /* ensure menu is in window limits */ - if ((x1 + menu->w) >= TermWin.width) + if ((x1 + menu->w) >= width) x1 = (TermWin_TotalWidth () - menu->w); - if ((y1 + menu->h) >= TermWin.height) + if ((y1 + menu->h) >= height) y1 = (TermWin_TotalHeight () - menu->h); menu->x = (x1 < 0 ? 0 : x1); @@ -1037,14 +1037,14 @@ name = NULL; if (len && name) - draw_string (*ActiveMenu->drawable, gc, TermWin.fontset, + draw_string (*ActiveMenu->drawable, gc, fontset[0], xoff, 2 * SHADOW + y, name, len); len = item->len2; name = item->name2; if (len && name) - draw_string (*ActiveMenu->drawable, gc, TermWin.fontset, + draw_string (*ActiveMenu->drawable, gc, fontset[0], ActiveMenu->w - (xoff + Width2Pixel (xright)), 2 * SHADOW + y, name, len); h = HEIGHT_TEXT + 2 * SHADOW; @@ -1565,9 +1565,9 @@ } } } + /* * remove leading/trailing space - * and strip-off leading/trailing quotes * skip blank or comment lines */ rxvt_Str_trim (p); @@ -1946,6 +1946,7 @@ else BuildMenu = menu; } + if (BuildMenu != NULL) { if (name == NULL || name[0] == '\0') @@ -1954,7 +1955,6 @@ { const char *n1; menuitem_t *item; - menu_t *BuildMenu = BuildMenu; n1 = strcmp (name, SEPARATOR_NAME) ? name : ""; item = rxvt_menuitem_find (BuildMenu, n1); @@ -1973,6 +1973,7 @@ } } } + menubar_expose (); } break; @@ -2017,7 +2018,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); } @@ -2060,30 +2061,30 @@ 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); - 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; + ncol = (int)ncol; if (x < (ncol - (NARROWS + 1))) { ncol -= (NARROWS + 1); @@ -2127,7 +2128,7 @@ 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); } @@ -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)) ;