X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2FBasemenu.cc;h=775d49a882983f87e8b737c0cc7a22d0219a6c3a;hb=2dde696a1335ef61bb368c55f4ee52e1dd8610a1;hp=2dd6af7049f07993011e2b925e490c88a7eec192;hpb=08d793bb796f608774d6fdefd1950df54477e2c6;p=chaz%2Fopenbox diff --git a/src/Basemenu.cc b/src/Basemenu.cc index 2dd6af70..775d49a8 100644 --- a/src/Basemenu.cc +++ b/src/Basemenu.cc @@ -202,7 +202,7 @@ int Basemenu::insert(BasemenuItem *item, int pos) { if (pos < 0) { menuitems.push_back(item); } else { - assert(pos < static_cast(menuitems.size())); + assert(pos <= static_cast(menuitems.size())); menuitems.insert((menuitems.begin() + pos), item); } return menuitems.size(); @@ -442,7 +442,7 @@ void Basemenu::move(int x, int y) { void Basemenu::redrawTitle(void) { const char *text = (! menu.label.empty()) ? getLabel() : i18n(BasemenuSet, BasemenuBlackboxMenu, "Blackbox Menu"); - int dx = menu.bevel_w, len = strlen(text); + int dx = menu.bevel_w; unsigned int l; MenuStyle *style = screen->getMenuStyle(); @@ -544,7 +544,7 @@ void Basemenu::drawItem(int index, bool highlight, bool clear, int sbl = index / menu.persub, i = index - (sbl * menu.persub); int item_x = (sbl * menu.item_w), item_y = (i * menu.item_h); int hilite_x = item_x, hilite_y = item_y, hoff_x = 0, hoff_y = 0; - int text_x = 0, text_y = 0, len = strlen(text), sel_x = 0, sel_y = 0; + int text_x = 0, text_y = 0, sel_x = 0, sel_y = 0; unsigned int hilite_w = menu.item_w, hilite_h = menu.item_h, text_w = 0, text_h = 0; unsigned int half_w = menu.item_h / 2, quarter_w = menu.item_h / 4; @@ -636,28 +636,31 @@ void Basemenu::drawItem(int index, bool highlight, bool clear, } if (dosel && item->submenu()) { + const int bullet_size = 3; + switch (screen->getMenuStyle()->bullet) { case Square: - XDrawRectangle(display, menu.frame, pen.gc(), sel_x, sel_y, half_w, half_w); + XDrawRectangle(display, menu.frame, pen.gc(), sel_x, sel_y, + bullet_size * 2, bullet_size * 2); break; case Triangle: XPoint tri[3]; if (screen->getMenuStyle()->bullet_pos == Right) { - tri[0].x = sel_x + quarter_w - 2; - tri[0].y = sel_y + quarter_w - 2; - tri[1].x = 4; - tri[1].y = 2; - tri[2].x = -4; - tri[2].y = 2; + tri[0].x = sel_x + quarter_w - bullet_size; + tri[0].y = sel_y + quarter_w - bullet_size; + tri[1].x = 2 * bullet_size; + tri[1].y = bullet_size; + tri[2].x = -(2 * bullet_size); + tri[2].y = bullet_size; } else { - tri[0].x = sel_x + quarter_w - 2; + tri[0].x = sel_x + quarter_w - bullet_size; tri[0].y = item_y + half_w; - tri[1].x = 4; - tri[1].y = 2; + tri[1].x = 2 * bullet_size; + tri[1].y = bullet_size; tri[2].x = 0; - tri[2].y = -4; + tri[2].y = -(2 * bullet_size); } XFillPolygon(display, menu.frame, pen.gc(), tri, 3, Convex, @@ -667,14 +670,14 @@ void Basemenu::drawItem(int index, bool highlight, bool clear, case Diamond: XPoint dia[4]; - dia[0].x = sel_x + quarter_w - 3; + dia[0].x = sel_x + quarter_w - bullet_size; dia[0].y = item_y + half_w; - dia[1].x = 3; - dia[1].y = -3; - dia[2].x = 3; - dia[2].y = 3; - dia[3].x = -3; - dia[3].y = 3; + dia[1].x = bullet_size; + dia[1].y = -bullet_size; + dia[2].x = bullet_size; + dia[2].y = bullet_size; + dia[3].x = -bullet_size; + dia[3].y = bullet_size; XFillPolygon(display, menu.frame, pen.gc(), dia, 4, Convex, CoordModePrevious);