added a configure flag for enabling/disabling bitmap buttons
@@ -249,6 +249,25 @@ if test x$TIMEDCACHE = "xyes"; then
AC_DEFINE(TIMEDCACHE,1,Use timed pixmap cache) fi +dnl Check for bitmapped buttons +BITMAPBUTTONS="" +AC_MSG_CHECKING([whether to include bitmappable buttons]) +AC_ARG_ENABLE( + bitmap-buttons, +[ --enable-bitmap-buttons include bitmappable buttons [default=yes]], + if test x$enableval = "xyes"; then + AC_MSG_RESULT([yes]) + BITMAPBUTTONS="yes" + else + AC_MSG_RESULT([no]) + fi, + AC_MSG_RESULT([yes]) + BITMAPBUTTONS="yes" +) +if test x$BITMAPBUTTONS = "xyes"; then + AC_DEFINE(BITMAPBUTTONS,1,Include bitmappable buttons) +fi + dnl Determine the return type of signal handlers AC_TYPE_SIGNAL
@@ -339,6 +339,7 @@ delete resource.mstyle.f_font;
if (resource.tstyle.font) delete resource.tstyle.font; +#ifdef BITMAPBUTTONS if (resource.wstyle.close_button.mask != None) XFreePixmap(blackbox->getXDisplay(), resource.wstyle.close_button.mask); if (resource.wstyle.max_button.mask != None)@@ -363,6 +364,7 @@ resource.wstyle.icon_button.mask =
resource.wstyle.stick_button.mask = None; resource.tstyle.left_button.mask = resource.tstyle.right_button.mask = None; resource.mstyle.bullet_image.mask = resource.mstyle.tick_image.mask = None; +#endif // BITMAPBUTTONS XFreeGC(blackbox->getXDisplay(), opGC); }@@ -1062,6 +1064,7 @@ readDatabaseTexture("window.button.unfocus", "black", style);
resource.wstyle.b_pressed = readDatabaseTexture("window.button.pressed", "black", style); +#ifdef BITMAPBUTTONS if (resource.wstyle.close_button.mask != None) XFreePixmap(blackbox->getXDisplay(), resource.wstyle.close_button.mask); if (resource.wstyle.max_button.mask != None)@@ -1083,6 +1086,7 @@ readDatabaseMask("window.button.icon.mask", resource.wstyle.icon_button,
style); readDatabaseMask("window.button.stick.mask", resource.wstyle.stick_button, style); +#endif // BITMAPBUTTONS // we create the window.frame texture by hand because it exists only to // make the code cleaner and is not actually used for display@@ -1124,10 +1128,12 @@ if (resource.wstyle.h_unfocus.texture() == BTexture::Parent_Relative)
resource.wstyle.h_unfocus = resource.wstyle.f_unfocus; // load toolbar config +#ifdef BITMAPBUTTONS if (resource.tstyle.left_button.mask != None) XFreePixmap(blackbox->getXDisplay(), resource.tstyle.left_button.mask); if (resource.tstyle.right_button.mask != None) XFreePixmap(blackbox->getXDisplay(), resource.tstyle.right_button.mask); +#endif // BITMAPBUTTONS resource.tstyle.toolbar = readDatabaseTexture("toolbar", "black", style);@@ -1149,10 +1155,13 @@ resource.tstyle.c_text =
readDatabaseColor("toolbar.clock.textColor", "white", style); resource.tstyle.b_pic = readDatabaseColor("toolbar.button.picColor", "black", style); + +#ifdef BITMAPBUTTONS readDatabaseMask("toolbar.button.left.mask", resource.tstyle.left_button, style); readDatabaseMask("toolbar.button.right.mask", resource.tstyle.right_button, style); +#endif // BITMAPBUTTONS resource.tstyle.justify = LeftJustify; if (style.getValue("toolbar.justify", s)) {@@ -1171,10 +1180,12 @@ getScreenNumber()));
} // load menu config +#ifdef BITMAPBUTTONS if (resource.mstyle.bullet_image.mask != None) XFreePixmap(blackbox->getXDisplay(), resource.mstyle.bullet_image.mask); if (resource.mstyle.tick_image.mask != None) XFreePixmap(blackbox->getXDisplay(), resource.mstyle.tick_image.mask); +#endif // BITMAPBUTTONS resource.mstyle.title = readDatabaseTexture("menu.title", "white", style);@@ -1190,8 +1201,11 @@ resource.mstyle.d_text =
readDatabaseColor("menu.frame.disableColor", "black", style); resource.mstyle.h_text = readDatabaseColor("menu.hilite.textColor", "black", style); + +#ifdef BITMAPBUTTONS readDatabaseMask("menu.arrow.mask", resource.mstyle.bullet_image, style); readDatabaseMask("menu.selected.mask", resource.mstyle.tick_image, style); +#endif // BITMAPBUTTONS resource.mstyle.t_justify = LeftJustify; if (style.getValue("menu.title.justify", s)) {@@ -2629,6 +2643,7 @@ std::for_each(windowList.begin(), windowList.end(),
std::mem_fun(&BlackboxWindow::grabButtons)); } +#ifdef BITMAPBUTTONS void BScreen::readDatabaseMask(const string &rname, PixmapMask &pixmapMask, const Configuration &style) { string s;@@ -2655,6 +2670,7 @@
pixmapMask.mask = None; pixmapMask.w = pixmapMask.h = 0; } +#endif // BITMAPSUCCESS BTexture BScreen::readDatabaseTexture(const string &rname, const string &default_color,
@@ -61,10 +61,12 @@ struct Strut;
enum TextJustify { LeftJustify = 1, RightJustify, CenterJustify }; +#ifdef BITMAPBUTTONS struct PixmapMask { Pixmap mask; unsigned int w, h; }; +#endif // BITMAPBUTTONS struct WindowStyle { BColor l_text_focus, l_text_unfocus, b_pic_focus,@@ -72,8 +74,9 @@ b_pic_unfocus;
BTexture f_focus, f_unfocus, t_focus, t_unfocus, l_focus, l_unfocus, h_focus, h_unfocus, b_focus, b_unfocus, b_pressed, g_focus, g_unfocus; +#ifdef BITMAPBUTTONS PixmapMask close_button, max_button, icon_button, stick_button; - +#endif // BITMAPBUTTONS BFont *font; TextJustify justify;@@ -86,7 +89,9 @@ struct ToolbarStyle {
BColor l_text, w_text, c_text, b_pic; BTexture toolbar, label, window, button, pressed, clock; - PixmapMask left_button, right_button; //these should probably be the same +#ifdef BITMAPBUTTONS + PixmapMask left_button, right_button; +#endif // BITMAPBUTTONS BFont *font;@@ -99,8 +104,10 @@
struct MenuStyle { BColor t_text, f_text, h_text, d_text; BTexture title, frame, hilite; - + +#ifdef BITMAPBUTTONS PixmapMask bullet_image, tick_image; +#endif // BITMAPBUTTONS BFont *t_font, *f_font;@@ -191,9 +198,12 @@ BScreen& operator=(const BScreen&);
bool parseMenuFile(FILE *file, Rootmenu *menu); +#ifdef BITMAPBUTTONS void readDatabaseMask(const string &rname, PixmapMask &pixmapMask, const Configuration &style); +#endif // BITMAPBUTTONS + BTexture readDatabaseTexture(const std::string &rname, const std::string &default_color, const Configuration &style);
@@ -633,16 +633,8 @@ const int bullet_size = 3;
if (left) { - if (style->left_button.mask == None) { - pts[0].x = hw - bullet_size; - pts[0].y = hh; - pts[1].x = 2 * bullet_size; - pts[1].y = bullet_size; - pts[2].x = 0; - pts[2].y = -(2 * bullet_size); - XFillPolygon(display, surface, pen.gc(), pts, 3, Convex, - CoordModePrevious); - } else { +#ifdef BITMAPBUTTONS + if (style->left_button.mask != None) { XSetClipMask(blackbox->getXDisplay(), pen.gc(), style->left_button.mask); XSetClipOrigin(blackbox->getXDisplay(), pen.gc(), (frame.button_w - style->left_button.w)/2,@@ -655,18 +647,22 @@ style->left_button.w, style->left_button.h);
XSetClipMask(blackbox->getXDisplay(), pen.gc(), None); XSetClipOrigin(blackbox->getXDisplay(), pen.gc(), 0, 0); - } - } else { - if (style->right_button.mask == None) { + } else { +#endif // BITMAPBUTTONS pts[0].x = hw - bullet_size; - pts[0].y = hh - bullet_size; - pts[1].x = (2 * bullet_size); - pts[1].y = bullet_size; - pts[2].x = -(2 * bullet_size); - pts[2].y = bullet_size; + pts[0].y = hh; + pts[1].x = 2 * bullet_size; + pts[1].y = bullet_size; + pts[2].x = 0; + pts[2].y = -(2 * bullet_size); XFillPolygon(display, surface, pen.gc(), pts, 3, Convex, CoordModePrevious); - } else { +#ifdef BITMAPBUTTONS + } +#endif // BITMAPBUTTONS + } else { +#ifdef BITMAPBUTTONS + if (style->right_button.mask != None) { XSetClipMask(blackbox->getXDisplay(), pen.gc(), style->right_button.mask); XSetClipOrigin(blackbox->getXDisplay(), pen.gc(),@@ -681,7 +677,19 @@ (frame.button_w + style->right_button.h)/2);
XSetClipMask(blackbox->getXDisplay(), pen.gc(), None); XSetClipOrigin(blackbox->getXDisplay(), pen.gc(), 0, 0); + } else { +#endif // BITMAPBUTTONS + pts[0].x = hw - bullet_size; + pts[0].y = hh - bullet_size; + pts[1].x = (2 * bullet_size); + pts[1].y = bullet_size; + pts[2].x = -(2 * bullet_size); + pts[2].y = bullet_size; + XFillPolygon(display, surface, pen.gc(), pts, 3, Convex, + CoordModePrevious); +#ifdef BITMAPBUTTONS } +#endif } }
@@ -2618,7 +2618,7 @@
XClearWindow(blackbox->getXDisplay(), frame.iconify_button); BPen pen((flags.focused) ? screen->getWindowStyle()->b_pic_focus : screen->getWindowStyle()->b_pic_unfocus); - +#ifdef BITMAPBUTTONS PixmapMask pm = screen->getWindowStyle()->icon_button; if (screen->getWindowStyle()->icon_button.mask != None) {@@ -2633,10 +2633,12 @@
XSetClipMask(blackbox->getXDisplay(), pen.gc(), None); XSetClipOrigin(blackbox->getXDisplay(), pen.gc(), 0, 0); } else { - +#endif // BITMAPBUTTONS XDrawRectangle(blackbox->getXDisplay(), frame.iconify_button, pen.gc(), 2, (frame.button_w - 5), (frame.button_w - 5), 2); +#ifdef BITMAPBUTTONS } +#endif // BITMAPBUTTONS }@@ -2669,7 +2671,8 @@ XClearWindow(blackbox->getXDisplay(), frame.maximize_button);
BPen pen((flags.focused) ? screen->getWindowStyle()->b_pic_focus : screen->getWindowStyle()->b_pic_unfocus); - + +#ifdef BITMAPBUTTONS PixmapMask pm = screen->getWindowStyle()->max_button; if (pm.mask != None) {@@ -2684,11 +2687,14 @@
XSetClipOrigin(blackbox->getXDisplay(), pen.gc(), 0, 0 ); XSetClipMask( blackbox->getXDisplay(), pen.gc(), None ); } else { +#endif // BITMAPBUTTONS XDrawRectangle(blackbox->getXDisplay(), frame.maximize_button, pen.gc(), 2, 2, (frame.button_w - 5), (frame.button_w - 5)); XDrawLine(blackbox->getXDisplay(), frame.maximize_button, pen.gc(), 2, 3, (frame.button_w - 3), 3); +#ifdef BITMAPBUTTONS } +#endif // BITMAPBUTTONS }@@ -2721,7 +2727,8 @@ XClearWindow(blackbox->getXDisplay(), frame.close_button);
BPen pen((flags.focused) ? screen->getWindowStyle()->b_pic_focus : screen->getWindowStyle()->b_pic_unfocus); - + +#ifdef BITMAPBUTTONS PixmapMask pm = screen->getWindowStyle()->close_button; if (pm.mask != None) {@@ -2737,11 +2744,14 @@
XSetClipOrigin(blackbox->getXDisplay(), pen.gc(), 0, 0 ); XSetClipMask( blackbox->getXDisplay(), pen.gc(), None ); } else { +#endif // BITMAPBUTTONS XDrawLine(blackbox->getXDisplay(), frame.close_button, pen.gc(), 2, 2, (frame.button_w - 3), (frame.button_w - 3)); XDrawLine(blackbox->getXDisplay(), frame.close_button, pen.gc(), 2, (frame.button_w - 3), (frame.button_w - 3), 2); +#ifdef BITMAPBUTTONS } +#endif // BITMAPBUTTONS } void BlackboxWindow::redrawStickyButton(bool pressed) const {@@ -2773,7 +2783,8 @@ XClearWindow(blackbox->getXDisplay(), frame.stick_button);
BPen pen((flags.focused) ? screen->getWindowStyle()->b_pic_focus : screen->getWindowStyle()->b_pic_unfocus); - + +#ifdef BITMAPBUTTONS PixmapMask pm = screen->getWindowStyle()->stick_button; if (pm.mask != None) {@@ -2789,9 +2800,12 @@
XSetClipOrigin(blackbox->getXDisplay(), pen.gc(), 0, 0 ); XSetClipMask( blackbox->getXDisplay(), pen.gc(), None ); } else { +#endif // BITMAPBUTTONS XFillRectangle(blackbox->getXDisplay(), frame.stick_button, pen.gc(), frame.button_w/2 - 1, frame.button_w/2 -1, 2, 2 ); +#ifdef BITMAPBUTTONS } +#endif } void BlackboxWindow::mapRequestEvent(const XMapRequestEvent *re) {