aboutsummaryrefslogtreecommitdiff
path: root/src/Basemenu.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-04-28 15:54:59 (GMT)
committerfluxgen <fluxgen>2002-04-28 15:54:59 (GMT)
commita1c872415ab45340d7346e5e58232d371ca18d52 (patch)
treecd2f364e2609ba57fd254a01f6195ed984348e96 /src/Basemenu.cc
parentbd878465b9d26368e2f7bd014b1fce59bc5fdcd2 (diff)
downloadfluxbox_pavel-a1c872415ab45340d7346e5e58232d371ca18d52.zip
fluxbox_pavel-a1c872415ab45340d7346e5e58232d371ca18d52.tar.bz2
minor fixes
Diffstat (limited to 'src/Basemenu.cc')
-rw-r--r--src/Basemenu.cc25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/Basemenu.cc b/src/Basemenu.cc
index 9ddcb2e..354f4e6 100644
--- a/src/Basemenu.cc
+++ b/src/Basemenu.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Basemenu.cc,v 1.21 2002/04/09 12:22:06 fluxgen Exp $ 25// $Id: Basemenu.cc,v 1.22 2002/04/28 15:54:59 fluxgen Exp $
26 26
27//use GNU extensions 27//use GNU extensions
28#ifndef _GNU_SOURCE 28#ifndef _GNU_SOURCE
@@ -58,9 +58,9 @@ static Basemenu *shown = (Basemenu *) 0;
58Basemenu::Basemenu(BScreen *screen): 58Basemenu::Basemenu(BScreen *screen):
59m_fluxbox(Fluxbox::instance()), 59m_fluxbox(Fluxbox::instance()),
60m_screen(screen), 60m_screen(screen),
61m_display(m_fluxbox->getXDisplay()), 61m_display(Fluxbox::instance()->getXDisplay()),
62m_parent(0), 62m_parent(0),
63m_image_ctrl(m_screen->getImageControl()), 63m_image_ctrl(screen->getImageControl()),
64m_alignment(ALIGNDONTCARE) { 64m_alignment(ALIGNDONTCARE) {
65 65
66 title_vis = 66 title_vis =
@@ -439,7 +439,8 @@ void Basemenu::hide(void) {
439 if ((! torn) && hide_tree && m_parent && m_parent->isVisible()) { 439 if ((! torn) && hide_tree && m_parent && m_parent->isVisible()) {
440 Basemenu *p = m_parent; 440 Basemenu *p = m_parent;
441 441
442 while (p->isVisible() && (! p->torn) && p->m_parent) p = p->m_parent; 442 while (p->isVisible() && (! p->torn) && p->m_parent)
443 p = p->m_parent;
443 p->internal_hide(); 444 p->internal_hide();
444 } else 445 } else
445 internal_hide(); 446 internal_hide();
@@ -459,7 +460,7 @@ void Basemenu::internal_hide(void) {
459 } else if (shown && shown->menu.window == menu.window) 460 } else if (shown && shown->menu.window == menu.window)
460 shown = (Basemenu *) 0; 461 shown = (Basemenu *) 0;
461 462
462 torn = visible = False; 463 torn = visible = false;
463 which_sub = which_press = which_sub = -1; 464 which_sub = which_press = which_sub = -1;
464 465
465 XUnmapWindow(m_display, menu.window); 466 XUnmapWindow(m_display, menu.window);
@@ -635,7 +636,8 @@ bool Basemenu::hasSubmenu(unsigned int index) const {
635void Basemenu::drawItem(unsigned int index, bool highlight, bool clear, 636void Basemenu::drawItem(unsigned int index, bool highlight, bool clear,
636 int x, int y, unsigned int w, unsigned int h) 637 int x, int y, unsigned int w, unsigned int h)
637{ 638{
638 if (index >= menuitems.size()) return; 639 if (index >= menuitems.size() || menuitems.size() == 0)
640 return;
639 641
640 BasemenuItem *item = menuitems[index]; 642 BasemenuItem *item = menuitems[index];
641 if (! item) return; 643 if (! item) return;
@@ -880,7 +882,7 @@ void Basemenu::buttonPressEvent(XButtonEvent *be) {
880void Basemenu::buttonReleaseEvent(XButtonEvent *re) { 882void Basemenu::buttonReleaseEvent(XButtonEvent *re) {
881 if (re->window == menu.title) { 883 if (re->window == menu.title) {
882 if (moving) { 884 if (moving) {
883 moving = False; 885 moving = false;
884 886
885 if (which_sub >= 0) 887 if (which_sub >= 0)
886 drawSubmenu(which_sub); 888 drawSubmenu(which_sub);
@@ -1071,7 +1073,7 @@ void Basemenu::enterNotifyEvent(XCrossingEvent *ce) {
1071 XMoveWindow(m_display, menu.window, menu.x_shift, menu.y_shift); 1073 XMoveWindow(m_display, menu.window, menu.x_shift, menu.y_shift);
1072 } 1074 }
1073 1075
1074 if (which_sub >= 0) { 1076 if (which_sub >= 0 && static_cast<size_t>(which_sub) < menuitems.size()) {
1075 BasemenuItem *tmp = menuitems[which_sub]; 1077 BasemenuItem *tmp = menuitems[which_sub];
1076 if (tmp->submenu()->isVisible()) { 1078 if (tmp->submenu()->isVisible()) {
1077 int sbl = (ce->x / menu.item_w), i = (ce->y / menu.item_h), 1079 int sbl = (ce->x / menu.item_w), i = (ce->y / menu.item_h),
@@ -1094,16 +1096,17 @@ void Basemenu::leaveNotifyEvent(XCrossingEvent *ce) {
1094 if (which_press != -1 && which_sbl != -1 && menuitems.size() > 0) { 1096 if (which_press != -1 && which_sbl != -1 && menuitems.size() > 0) {
1095 int p = (which_sbl * menu.persub) + which_press; 1097 int p = (which_sbl * menu.persub) + which_press;
1096 1098
1097 drawItem(p, (p == which_sub), True); 1099 drawItem(p, (p == which_sub), true);
1098 1100
1099 which_sbl = which_press = -1; 1101 which_sbl = which_press = -1;
1100 } 1102 }
1101 1103
1102 if (shifted) { 1104 if (shifted) {
1103 XMoveWindow(m_display, menu.window, menu.x, menu.y); 1105 XMoveWindow(m_display, menu.window, menu.x, menu.y);
1104 shifted = False; 1106 shifted = false;
1105 1107
1106 if (which_sub >= 0) drawSubmenu(which_sub); 1108 if (which_sub >= 0)
1109 drawSubmenu(which_sub);
1107 } 1110 }
1108 } 1111 }
1109} 1112}