ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/menubar.C
(Generate patch)

Comparing rxvt-unicode/src/menubar.C (file contents):
Revision 1.25 by root, Wed Nov 30 14:23:29 2005 UTC vs.
Revision 1.26 by root, Sun Dec 18 00:59:42 2005 UTC

753{ 753{
754 GC top, bot; 754 GC top, bot;
755 755
756 x = Width2Pixel (x); 756 x = Width2Pixel (x);
757 len = Width2Pixel (len + HSPACE); 757 len = Width2Pixel (len + HSPACE);
758 if (x >= TermWin.width) 758 if (x >= width)
759 return; 759 return;
760 else if (x + len >= TermWin.width) 760 else if (x + len >= width)
761 len = (TermWin_TotalWidth () - x); 761 len = (TermWin_TotalWidth () - x);
762 762
763#ifdef MENUBAR_SHADOW_IN 763#ifdef MENUBAR_SHADOW_IN
764 state = -state; 764 state = -state;
765#endif 765#endif
942 x = Width2Pixel (x); 942 x = Width2Pixel (x);
943 943
944 ActiveMenu->y = 1; 944 ActiveMenu->y = 1;
945 ActiveMenu->w = Menu_PixelWidth (ActiveMenu); 945 ActiveMenu->w = Menu_PixelWidth (ActiveMenu);
946 946
947 if ((x + ActiveMenu->w) >= TermWin.width) 947 if ((x + ActiveMenu->w) >= width)
948 x = (TermWin_TotalWidth () - ActiveMenu->w); 948 x = (TermWin_TotalWidth () - ActiveMenu->w);
949 949
950 /* find the height */ 950 /* find the height */
951 for (h = 0, item = ActiveMenu->head; item != NULL; item = item->next) 951 for (h = 0, item = ActiveMenu->head; item != NULL; item = item->next)
952 h += isSeparator (item->name) ? HEIGHT_SEPARATOR 952 h += isSeparator (item->name) ? HEIGHT_SEPARATOR
954 ActiveMenu->h = h + 2 * SHADOW; 954 ActiveMenu->h = h + 2 * SHADOW;
955 } 955 }
956 956
957 if (ActiveMenu->win == None) 957 if (ActiveMenu->win == None)
958 { 958 {
959 ActiveMenu->win = XCreateSimpleWindow (display->display, TermWin.vt, 959 ActiveMenu->win = XCreateSimpleWindow (display->display, vt,
960 x, ActiveMenu->y, 960 x, ActiveMenu->y,
961 ActiveMenu->w, ActiveMenu->h, 961 ActiveMenu->w, ActiveMenu->h,
962 0, 962 0,
963 pix_colors[Color_fg], 963 pix_colors[Color_fg],
964 pix_colors[Color_scroll]); 964 pix_colors[Color_scroll]);
1022 h += isSeparator (it->name) ? HEIGHT_SEPARATOR 1022 h += isSeparator (it->name) ? HEIGHT_SEPARATOR
1023 : HEIGHT_TEXT + 2 * SHADOW; 1023 : HEIGHT_TEXT + 2 * SHADOW;
1024 menu->h = h + 2 * SHADOW; 1024 menu->h = h + 2 * SHADOW;
1025 1025
1026 /* ensure menu is in window limits */ 1026 /* ensure menu is in window limits */
1027 if ((x1 + menu->w) >= TermWin.width) 1027 if ((x1 + menu->w) >= width)
1028 x1 = (TermWin_TotalWidth () - menu->w); 1028 x1 = (TermWin_TotalWidth () - menu->w);
1029 1029
1030 if ((y1 + menu->h) >= TermWin.height) 1030 if ((y1 + menu->h) >= height)
1031 y1 = (TermWin_TotalHeight () - menu->h); 1031 y1 = (TermWin_TotalHeight () - menu->h);
1032 1032
1033 menu->x = (x1 < 0 ? 0 : x1); 1033 menu->x = (x1 < 0 ? 0 : x1);
1034 menu->y = (y1 < 0 ? 0 : y1); 1034 menu->y = (y1 < 0 ? 0 : y1);
1035 } 1035 }
1036 else if (item->name2 && !strcmp (name, item->name2)) 1036 else if (item->name2 && !strcmp (name, item->name2))
1037 name = NULL; 1037 name = NULL;
1038 1038
1039 if (len && name) 1039 if (len && name)
1040 draw_string (*ActiveMenu->drawable, gc, TermWin.fontset[0], 1040 draw_string (*ActiveMenu->drawable, gc, fontset[0],
1041 xoff, 2 * SHADOW + y, name, len); 1041 xoff, 2 * SHADOW + y, name, len);
1042 1042
1043 len = item->len2; 1043 len = item->len2;
1044 name = item->name2; 1044 name = item->name2;
1045 1045
1046 if (len && name) 1046 if (len && name)
1047 draw_string (*ActiveMenu->drawable, gc, TermWin.fontset[0], 1047 draw_string (*ActiveMenu->drawable, gc, fontset[0],
1048 ActiveMenu->w - (xoff + Width2Pixel (xright)), 2 * SHADOW + y, name, len); 1048 ActiveMenu->w - (xoff + Width2Pixel (xright)), 2 * SHADOW + y, name, len);
1049 1049
1050 h = HEIGHT_TEXT + 2 * SHADOW; 1050 h = HEIGHT_TEXT + 2 * SHADOW;
1051 } 1051 }
1052 y += h; 1052 y += h;
2059 2059
2060#ifdef DEBUG_MENU_LAYOUT 2060#ifdef DEBUG_MENU_LAYOUT
2061 rxvt_print_menu_descendants (menu); 2061 rxvt_print_menu_descendants (menu);
2062#endif 2062#endif
2063 2063
2064 if (x >= TermWin.ncol) 2064 if (x >= ncol)
2065 len = (TermWin.ncol - (menu->x + HSPACE)); 2065 len = (ncol - (menu->x + HSPACE));
2066 2066
2067 drawbox_menubar (menu->x, len, +1); 2067 drawbox_menubar (menu->x, len, +1);
2068 draw_string (*menuBar.drawable, menubarGC, TermWin.fontset[0], 2068 draw_string (*menuBar.drawable, menubarGC, fontset[0],
2069 (Width2Pixel (menu->x) + Width2Pixel (HSPACE) / 2), 2069 (Width2Pixel (menu->x) + Width2Pixel (HSPACE) / 2),
2070 SHADOW, menu->name, len); 2070 SHADOW, menu->name, len);
2071 2071
2072 if (x >= TermWin.ncol) 2072 if (x >= ncol)
2073 break; 2073 break;
2074 } 2074 }
2075 } 2075 }
2076 drawbox_menubar (x, TermWin.ncol, (CurrentBar ? +1 : -1)); 2076 drawbox_menubar (x, ncol, (CurrentBar ? +1 : -1));
2077 2077
2078 /* add the menuBar title, if it exists and there's plenty of room */ 2078 /* add the menuBar title, if it exists and there's plenty of room */
2079 Arrows_x = 0; 2079 Arrows_x = 0;
2080 if (x < TermWin.ncol) 2080 if (x < ncol)
2081 { 2081 {
2082 const char *str; 2082 const char *str;
2083 int ncol; 2083 int ncol;
2084 unsigned int len; 2084 unsigned int len;
2085 char title[256]; 2085 char title[256];
2086 2086
2087 ncol = (int)TermWin.ncol; 2087 ncol = (int)ncol;
2088 if (x < (ncol - (NARROWS + 1))) 2088 if (x < (ncol - (NARROWS + 1)))
2089 { 2089 {
2090 ncol -= (NARROWS + 1); 2090 ncol -= (NARROWS + 1);
2091 Arrows_x = Width2Pixel (ncol); 2091 Arrows_x = Width2Pixel (ncol);
2092 } 2092 }
2126 } 2126 }
2127 title[len] = '\0'; 2127 title[len] = '\0';
2128 2128
2129 ncol -= (x + len + HSPACE); 2129 ncol -= (x + len + HSPACE);
2130 if (len > 0 && ncol >= 0) 2130 if (len > 0 && ncol >= 0)
2131 draw_string (*menuBar.drawable, menubarGC, TermWin.fontset[0], 2131 draw_string (*menuBar.drawable, menubarGC, fontset[0],
2132 Width2Pixel (x) + Width2Pixel (ncol + HSPACE) / 2, 2132 Width2Pixel (x) + Width2Pixel (ncol + HSPACE) / 2,
2133 SHADOW, title, len); 2133 SHADOW, title, len);
2134 } 2134 }
2135} 2135}
2136 2136
2404 if (ev.button == Button1) 2404 if (ev.button == Button1)
2405 menu_select (ev); 2405 menu_select (ev);
2406 break; 2406 break;
2407 2407
2408 case MotionNotify: 2408 case MotionNotify:
2409 while (XCheckTypedWindowEvent (display->display, TermWin.parent[0], 2409 while (XCheckTypedWindowEvent (display->display, parent[0],
2410 MotionNotify, (XEvent *)&ev)) ; 2410 MotionNotify, (XEvent *)&ev));
2411 2411
2412 if (ActiveMenu) 2412 if (ActiveMenu)
2413 while (menu_select (ev)) ; 2413 while (menu_select (ev)) ;
2414 else 2414 else
2415 ev.y = -1; 2415 ev.y = -1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines