From: root Date: Tue, 3 Jan 2006 02:42:17 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=215f2f8e663189e6d561d61f295f9ebe6f98bb24;p=dana%2Furxvt.git *** empty log message *** --- diff --git a/src/menubar.C b/src/menubar.C index 2b46bff5..7497deb8 100644 --- a/src/menubar.C +++ b/src/menubar.C @@ -33,7 +33,7 @@ #include "menubar.h" #define Menu_PixelWidth(menu) \ - (2 * SHADOW + Width2Pixel ((menu)->width + 3 * HSPACE)) + (2 * MENU_SHADOW + Width2Pixel ((menu)->width + 3 * HSPACE)) static const struct { @@ -806,10 +806,10 @@ rxvt_term::drawtriangle (int x, int y, int state) 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 +838,9 @@ rxvt_term::drawbox_menuitem (int y, int state) } 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); } @@ -950,8 +950,8 @@ rxvt_term::menu_show () /* 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) @@ -977,7 +977,7 @@ rxvt_term::menu_show () for (y = 0, item = ActiveMenu->head; item != NULL; item = item->next) { - const int xoff = (SHADOW + Width2Pixel (HSPACE) / 2); + const int xoff = (MENU_SHADOW + Width2Pixel (HSPACE) / 2); register int h; GC gc = menubarGC; @@ -985,8 +985,8 @@ rxvt_term::menu_show () { rxvt_Draw_Shadow (display->display, ActiveMenu->win, topShadowGC, botShadowGC, - SHADOW, y + SHADOW + 1, - ActiveMenu->w - 2 * SHADOW, 0); + MENU_SHADOW, y + MENU_SHADOW + 1, + ActiveMenu->w - 2 * MENU_SHADOW, 0); h = HEIGHT_SEPARATOR; } else @@ -1020,8 +1020,8 @@ rxvt_term::menu_show () /* find the height of this submenu */ for (h = 0, it = menu->head; it != NULL; it = it->next) h += isSeparator (it->name) ? HEIGHT_SEPARATOR - : 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) >= width) @@ -1038,16 +1038,16 @@ rxvt_term::menu_show () if (len && name) draw_string (*ActiveMenu->drawable, gc, fontset[0], - xoff, 2 * SHADOW + y, name, len); + xoff, 2 * MENU_SHADOW + y, name, len); len = item->len2; name = item->name2; if (len && name) draw_string (*ActiveMenu->drawable, gc, fontset[0], - ActiveMenu->w - (xoff + Width2Pixel (xright)), 2 * SHADOW + y, name, len); + ActiveMenu->w - (xoff + Width2Pixel (xright)), 2 * MENU_SHADOW + y, name, len); - h = HEIGHT_TEXT + 2 * SHADOW; + h = HEIGHT_TEXT + 2 * MENU_SHADOW; } y += h; } @@ -2067,7 +2067,7 @@ rxvt_term::menubar_expose () drawbox_menubar (menu->x, len, +1); draw_string (*menuBar.drawable, menubarGC, fontset[0], (Width2Pixel (menu->x) + Width2Pixel (HSPACE) / 2), - SHADOW, menu->name, len); + MENU_SHADOW, menu->name, len); if (x >= ncol) break; @@ -2129,7 +2129,7 @@ rxvt_term::menubar_expose () if (len > 0 && ncol >= 0) draw_string (*menuBar.drawable, menubarGC, fontset[0], Width2Pixel (x) + Width2Pixel (ncol + HSPACE) / 2, - SHADOW, title, len); + MENU_SHADOW, title, len); } } @@ -2184,12 +2184,12 @@ rxvt_term::menu_select (XButtonEvent &ev) } /* 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 +2207,7 @@ rxvt_term::menu_select (XButtonEvent &ev) } thisitem = item; - this_y = y - SHADOW; + this_y = y - MENU_SHADOW; /* erase the last item */ if (ActiveMenu->item != NULL) @@ -2230,7 +2230,7 @@ rxvt_term::menu_select (XButtonEvent &ev) break; } else - h = HEIGHT_TEXT + 2 * SHADOW; + h = HEIGHT_TEXT + 2 * MENU_SHADOW; y += h; } diff --git a/src/menubar.h b/src/menubar.h index be058306..bdf93c9f 100644 --- a/src/menubar.h +++ b/src/menubar.h @@ -68,7 +68,7 @@ typedef struct bar_t { #define HSPACE 1 /* one space */ #define isSeparator(name) ((name)[0] == '\0') -#define HEIGHT_SEPARATOR (SHADOW + 1) +#define HEIGHT_SEPARATOR (MENU_SHADOW + 1) #define HEIGHT_TEXT (Height2Pixel(1) + 2) #define MENU_DELAY_USEC 0 /* no delay */ diff --git a/src/misc.C b/src/misc.C index 13bcfb15..dfc9f9db 100644 --- a/src/misc.C +++ b/src/misc.C @@ -555,7 +555,7 @@ rxvt_Draw_Shadow (Display *display, Window win, GC topShadow, GC botShadow, int { int shadow; - shadow = (w == 0 || h == 0) ? 1 : SHADOW; + shadow = (w == 0 || h == 0) ? 1 : MENU_SHADOW; w += x - 1; h += y - 1; for (; shadow-- > 0; x++, y++, w--, h--) diff --git a/src/rxvt.h b/src/rxvt.h index 5c4cabbf..596066cf 100644 --- a/src/rxvt.h +++ b/src/rxvt.h @@ -240,9 +240,9 @@ typedef struct _mwmhints { /* width of scrollBar, menuBar shadow, must be 1 or 2 */ #ifdef HALFSHADOW -# define SHADOW 1 +# define MENU_SHADOW 1 #else -# define SHADOW 2 +# define MENU_SHADOW 2 #endif #define R_SB_ALIGN_CENTRE 0 @@ -784,8 +784,8 @@ enum { #if (MENUBAR_MAX > 1) /* rendition style flags */ -# define menuBar_height() (fheight + SHADOW) -# define menuBar_TotalHeight() (menuBar_height() + SHADOW + menuBar_margin) +# define menuBar_height() (fheight + MENU_SHADOW) +# define menuBar_TotalHeight() (menuBar_height() + MENU_SHADOW + menuBar_margin) # define isMenuBarWindow(w) ((w) == menuBar.win) #else # define menuBar_height() (0) diff --git a/src/rxvtperl.xs b/src/rxvtperl.xs index 4bd55e5b..a4129f7b 100644 --- a/src/rxvtperl.xs +++ b/src/rxvtperl.xs @@ -365,16 +365,36 @@ GET_BASEBG (int rend) RETVAL int -SET_FGCOLOR (int rend, int color) +SET_FGCOLOR (int rend, int new_color) CODE: - RETVAL = SET_FGCOLOR (rend, color); + RETVAL = SET_FGCOLOR (rend, new_color); OUTPUT: RETVAL int -SET_BGCOLOR (int rend, int color) +SET_BGCOLOR (int rend, int new_color) CODE: - RETVAL = SET_BGCOLOR (rend, color); + RETVAL = SET_BGCOLOR (rend, new_color); + OUTPUT: + RETVAL + +int +GET_CUSTOM (int rend) + CODE: + RETVAL = (rend && RS_customMask) >> RS_customShift; + OUTPUT: + RETVAL + +int +SET_CUSTOM (int rend, int new_value) + CODE: +{ + if (!IN_RANGE_EXC (new_value, 0, RS_customCount)) + croak ("custom value out of range, must be 0..%d", RS_customCount - 1); + + RETVAL = (rend & ~RS_customMask) + | ((new_value << RS_customShift) & RS_customMask); +} OUTPUT: RETVAL diff --git a/src/scrollbar-rxvt.C b/src/scrollbar-rxvt.C index a693842d..c7512d93 100644 --- a/src/scrollbar-rxvt.C +++ b/src/scrollbar-rxvt.C @@ -27,7 +27,7 @@ /*----------------------------------------------------------------------*/ #if defined(RXVT_SCROLLBAR) -/* draw triangular button with a shadow of SHADOW (1 or 2) pixels */ +/* draw triangular button with a shadow of MENU_SHADOW (1 or 2) pixels */ void rxvt_term::Draw_button (int x, int y, int state, int dirn) { @@ -80,7 +80,7 @@ rxvt_term::Draw_button (int x, int y, int state, int dirn) XDrawLine (display->display, scrollBar.win, top, pt[0].x, pt[0].y, pt[1].x, pt[1].y); -#if (SHADOW > 1) +#if (MENU_SHADOW > 1) /* doubled */ pt[0].x++; @@ -106,7 +106,7 @@ rxvt_term::Draw_button (int x, int y, int state, int dirn) XDrawLine (display->display, scrollBar.win, bot, pt[2].x, pt[2].y, pt[1].x, pt[1].y); -#if (SHADOW > 1) +#if (MENU_SHADOW > 1) /* doubled */ pt[1].x--; if (dirn == UP) diff --git a/src/scrollbar.C b/src/scrollbar.C index 4fad2b46..4e72080f 100644 --- a/src/scrollbar.C +++ b/src/scrollbar.C @@ -233,7 +233,7 @@ rxvt_term::setup_scrollbar (const char *scrollalign, const char *scrollstyle, co # if defined(RXVT_SCROLLBAR) if (! OPTION (Opt_scrollBar_floating) && style == R_SB_RXVT) - sb_shadow = SHADOW; + sb_shadow = MENU_SHADOW; # endif scrollBar.style = style; diff --git a/src/urxvt.pm b/src/urxvt.pm index 620166b5..4ecdc57e 100644 --- a/src/urxvt.pm +++ b/src/urxvt.pm @@ -220,8 +220,8 @@ Return the rendition mask used for overlays by default. =item $rendbit = urxvt::RS_Bold, RS_Italic, RS_Blink, RS_RVid, RS_Uline Return the bit that enabled bold, italic, blink, reverse-video and -underline, respectively. To enable such a style, just or it onto the -bitset. +underline, respectively. To enable such a style, just logically OR it into +the bitset. =item $foreground = urxvt::GET_BASEFG $rend @@ -236,6 +236,16 @@ Return the foreground/background colour index, respectively. Replace the foreground/background colour in the rendition mask with the specified one. +=item $value = urxvt::GET_CUSTOM ($rend) + +Return the "custom" value: Every rendition has 5 bits for use by +extensions. They can be set and changed as you like and are initially +zero. + +=item $rend = urxvt::SET_CUSTOM ($rend, $new_value) + +Change the custom value. + =back =cut