]> Dogcows Code - chaz/openbox/blobdiff - src/Basemenu.cc
refix i18n for --disable-nls
[chaz/openbox] / src / Basemenu.cc
index 99dcbfa0c544f7edc69a3ef78c8281c9d2eee592..c3052826262ede5148b1b881fbb04913757d5b73 100644 (file)
@@ -87,46 +87,46 @@ Basemenu::Basemenu(BScreen &scrn) : openbox(scrn.getOpenbox()), screen(scrn) {
 
   menu.bevel_w = screen.getBevelWidth();
 
-  if (i18n->multibyte())
+  if (i18n.multibyte())
     menu.width = menu.title_h = menu.item_w = menu.frame_h =
       screen.getMenuStyle()->t_fontset_extents->max_ink_extent.height +
-       (menu.bevel_w  * 2);
+      (menu.bevel_w  * 2);
   else
     menu.width = menu.title_h = menu.item_w = menu.frame_h =
       screen.getMenuStyle()->t_font->ascent +
-        screen.getMenuStyle()->t_font->descent + (menu.bevel_w * 2);
-  
+      screen.getMenuStyle()->t_font->descent + (menu.bevel_w * 2);
+
   menu.label = 0;
-  
+
   menu.sublevels =
     menu.persub =
     menu.minsub = 0;
-  
+
   MenuStyle *style = screen.getMenuStyle();
-  if (i18n->multibyte()) {
+  if (i18n.multibyte()) {
     menu.item_h = style->f_fontset_extents->max_ink_extent.height +
       (menu.bevel_w);
   } else {
     menu.item_h = style->f_font->ascent + style->f_font->descent +
-                 (menu.bevel_w);
+      (menu.bevel_w);
   }
-  
+
   menu.height = menu.title_h + screen.getBorderWidth() + menu.frame_h;
-  
+
   unsigned long attrib_mask = CWBackPixmap | CWBackPixel | CWBorderPixel |
-                             CWColormap | CWOverrideRedirect | CWEventMask;
+    CWColormap | CWOverrideRedirect | CWEventMask;
   XSetWindowAttributes attrib;
   attrib.background_pixmap = None;
   attrib.background_pixel = attrib.border_pixel =
-                           screen.getBorderColor()->getPixel();
+    screen.getBorderColor()->getPixel();
   attrib.colormap = screen.getColormap();
   attrib.override_redirect = True;
   attrib.event_mask = ButtonPressMask | ButtonReleaseMask |
-                      ButtonMotionMask | ExposureMask;
+    ButtonMotionMask | ExposureMask;
 
   menu.window =
     XCreateWindow(display, screen.getRootWindow(), menu.x, menu.y, menu.width,
-                 menu.height, screen.getBorderWidth(), screen.getDepth(),
+                  menu.height, screen.getBorderWidth(), screen.getDepth(),
                   InputOutput, screen.getVisual(), attrib_mask, &attrib);
   openbox.saveMenuSearch(menu.window, this);
 
@@ -136,16 +136,16 @@ Basemenu::Basemenu(BScreen &scrn) : openbox(scrn.getOpenbox()), screen(scrn) {
 
   menu.title =
     XCreateWindow(display, menu.window, 0, 0, menu.width, menu.height, 0,
-                 screen.getDepth(), InputOutput, screen.getVisual(),
-                 attrib_mask, &attrib);
+                  screen.getDepth(), InputOutput, screen.getVisual(),
+                  attrib_mask, &attrib);
   openbox.saveMenuSearch(menu.title, this);
 
   attrib.event_mask |= PointerMotionMask;
   menu.frame = XCreateWindow(display, menu.window, 0,
-                            menu.title_h + screen.getBorderWidth(),
-                            menu.width, menu.frame_h, 0,
-                            screen.getDepth(), InputOutput,
-                            screen.getVisual(), attrib_mask, &attrib);
+                             menu.title_h + screen.getBorderWidth(),
+                             menu.width, menu.frame_h, 0,
+                             screen.getDepth(), InputOutput,
+                             screen.getVisual(), attrib_mask, &attrib);
   openbox.saveMenuSearch(menu.frame, this);
 
   // even though this is the end of the constructor the menu is still not
@@ -243,15 +243,15 @@ int Basemenu::remove(int index) {
       Basemenu *tmp = (Basemenu *) item->submenu();
 
       if (! tmp->internal_menu) {
-       delete tmp;
+        delete tmp;
       } else {
-       tmp->internal_hide();
+        tmp->internal_hide();
       }
     }
 
     if (item->label())
       delete [] item->label();
-    
+
     if (item->exec())
       delete [] item->exec();
 
@@ -269,33 +269,33 @@ int Basemenu::remove(int index) {
 
 void Basemenu::update(void) {
   MenuStyle *style = screen.getMenuStyle();
-  if (i18n->multibyte()) {
+  if (i18n.multibyte()) {
     menu.item_h = style->f_fontset_extents->max_ink_extent.height +
-                 menu.bevel_w;
+      menu.bevel_w;
     menu.title_h = style->t_fontset_extents->max_ink_extent.height +
-                   (menu.bevel_w * 2);
+      (menu.bevel_w * 2);
   } else {
     menu.item_h = style->f_font->ascent + style->f_font->descent +
-                 menu.bevel_w;
+      menu.bevel_w;
     menu.title_h = style->t_font->ascent + style->t_font->descent +
-                  (menu.bevel_w * 2);
+      (menu.bevel_w * 2);
   }
-    
+
   if (title_vis) {
     const char *s = (menu.label) ? menu.label :
-                   i18n->getMessage(BasemenuSet, BasemenuOpenboxMenu,
-                                    "Openbox Menu");
+      i18n(BasemenuSet, BasemenuOpenboxMenu,
+           "Openbox Menu");
     int l = strlen(s);
-    
 
-    if (i18n->multibyte()) {
+
+    if (i18n.multibyte()) {
       XRectangle ink, logical;
       XmbTextExtents(screen.getMenuStyle()->t_fontset, s, l, &ink, &logical);
       menu.item_w = logical.width;
     } else {
       menu.item_w = XTextWidth(screen.getMenuStyle()->t_font, s, l);
     }
-    
+
     menu.item_w += (menu.bevel_w * 2);
   }  else {
     menu.item_w = 1;
@@ -305,10 +305,10 @@ void Basemenu::update(void) {
   menuitemList::const_iterator it = menuitems.begin();
   for (; it != menuitems.end(); it++) {
     const char *s = (((*it)->u && *(*it)->u) ? *(*it)->u :
-                    (((*it)->l) ? (*it)->l : (const char *) 0));
+                     (((*it)->l) ? (*it)->l : (const char *) 0));
     int l = strlen(s);
 
-    if (i18n->multibyte()) {
+    if (i18n.multibyte()) {
       XRectangle ink, logical;
       XmbTextExtents(screen.getMenuStyle()->f_fontset, s, l, &ink, &logical);
       ii = logical.width;
@@ -324,8 +324,8 @@ void Basemenu::update(void) {
     menu.sublevels = 1;
 
     while (((menu.item_h * (menuitems.size() + 1) / menu.sublevels)
-           + menu.title_h + screen.getBorderWidth()) >
-          screen.size().h())
+            + menu.title_h + screen.getBorderWidth()) >
+           screen.size().h())
       menu.sublevels++;
 
     if (menu.sublevels < menu.minsub) menu.sublevels = menu.minsub;
@@ -342,7 +342,7 @@ void Basemenu::update(void) {
 
   menu.frame_h = (menu.item_h * menu.persub);
   menu.height = ((title_vis) ? menu.title_h + screen.getBorderWidth() : 0) +
-               menu.frame_h;
+    menu.frame_h;
   if (! menu.frame_h) menu.frame_h = 1;
   if (menu.height < 1) menu.height = 1;
 
@@ -354,7 +354,7 @@ void Basemenu::update(void) {
     if (texture->getTexture() == (BImage_Flat | BImage_Solid)) {
       menu.title_pixmap = None;
       XSetWindowBackground(display, menu.title,
-                          texture->getColor()->getPixel());
+                           texture->getColor()->getPixel());
     } else {
       menu.title_pixmap =
         image_ctrl->renderImage(menu.width, menu.title_h, texture);
@@ -369,7 +369,7 @@ void Basemenu::update(void) {
   if (texture->getTexture() == (BImage_Flat | BImage_Solid)) {
     menu.frame_pixmap = None;
     XSetWindowBackground(display, menu.frame,
-                        texture->getColor()->getPixel());
+                         texture->getColor()->getPixel());
   } else {
     menu.frame_pixmap =
       image_ctrl->renderImage(menu.width, menu.frame_h, texture);
@@ -403,9 +403,9 @@ void Basemenu::update(void) {
     XResizeWindow(display, menu.title, menu.width, menu.title_h);
 
   XMoveResizeWindow(display, menu.frame, 0,
-                   ((title_vis) ? menu.title_h +
-                    screen.getBorderWidth() : 0), menu.width,
-                   menu.frame_h);
+                    ((title_vis) ? menu.title_h +
+                     screen.getBorderWidth() : 0), menu.width,
+                    menu.frame_h);
 
   XClearWindow(display, menu.window);
   XClearWindow(display, menu.title);
@@ -436,7 +436,7 @@ void Basemenu::show(void) {
 
   if (! parent) {
     if (shown && (! shown->torn))
-       shown->hide();
+      shown->hide();
 
     shown = this;
   }
@@ -487,12 +487,12 @@ void Basemenu::move(int x, int y) {
 
 void Basemenu::redrawTitle(void) {
   char *text = (char *) ((menu.label) ? menu.label :
-                        i18n->getMessage(BasemenuSet, BasemenuOpenboxMenu,
-                                         "Openbox Menu"));
+                         i18n(BasemenuSet, BasemenuOpenboxMenu,
+                              "Openbox Menu"));
   int dx = menu.bevel_w, len = strlen(text);
   unsigned int l;
 
-  if (i18n->multibyte()) {
+  if (i18n.multibyte()) {
     XRectangle ink, logical;
     XmbTextExtents(screen.getMenuStyle()->t_fontset, text, len, &ink, &logical);
     l = logical.width;
@@ -513,13 +513,13 @@ void Basemenu::redrawTitle(void) {
   }
 
   MenuStyle *style = screen.getMenuStyle();
-  if (i18n->multibyte())
+  if (i18n.multibyte())
     XmbDrawString(display, menu.title, style->t_fontset, style->t_text_gc, dx,
-                 (menu.bevel_w - style->t_fontset_extents->max_ink_extent.y),
-                 text, len);
+                  (menu.bevel_w - style->t_fontset_extents->max_ink_extent.y),
+                  text, len);
   else
     XDrawString(display, menu.title, style->t_text_gc, dx,
-               (style->t_font->ascent + menu.bevel_w), text, len);
+                (style->t_font->ascent + menu.bevel_w), text, len);
 }
 
 
@@ -534,47 +534,47 @@ void Basemenu::drawSubmenu(int index) {
   if (index >= 0 && index < (signed)menuitems.size()) {
     BasemenuItem *item = menuitems[index];
     if (item->submenu() && visible && (! item->submenu()->isTorn()) &&
-       item->isEnabled()) {
+        item->isEnabled()) {
       if (item->submenu()->parent != this) item->submenu()->parent = this;
       int sbl = index / menu.persub, i = index - (sbl * menu.persub),
-           x = menu.x +
-               ((menu.item_w * (sbl + 1)) + screen.getBorderWidth()), y;
-    
+      x = menu.x +
+        ((menu.item_w * (sbl + 1)) + screen.getBorderWidth()), y;
+
       if (alignment == AlignTop)
-       y = (((shifted) ? menu.y_shift : menu.y) +
-            ((title_vis) ? menu.title_h + screen.getBorderWidth() : 0) -
-            ((item->submenu()->title_vis) ?
-             item->submenu()->menu.title_h + screen.getBorderWidth() : 0));
+        y = (((shifted) ? menu.y_shift : menu.y) +
+             ((title_vis) ? menu.title_h + screen.getBorderWidth() : 0) -
+             ((item->submenu()->title_vis) ?
+              item->submenu()->menu.title_h + screen.getBorderWidth() : 0));
       else
-       y = (((shifted) ? menu.y_shift : menu.y) +
-            (menu.item_h * i) +
-            ((title_vis) ? menu.title_h + screen.getBorderWidth() : 0) -
-            ((item->submenu()->title_vis) ?
-             item->submenu()->menu.title_h + screen.getBorderWidth() : 0));
+        y = (((shifted) ? menu.y_shift : menu.y) +
+             (menu.item_h * i) +
+             ((title_vis) ? menu.title_h + screen.getBorderWidth() : 0) -
+             ((item->submenu()->title_vis) ?
+              item->submenu()->menu.title_h + screen.getBorderWidth() : 0));
 
       if (alignment == AlignBottom &&
-         (y + item->submenu()->menu.height) > ((shifted) ? menu.y_shift :
-                                               menu.y) + menu.height)
-       y = (((shifted) ? menu.y_shift : menu.y) +
-            menu.height - item->submenu()->menu.height);
+          (y + item->submenu()->menu.height) > ((shifted) ? menu.y_shift :
+                                                menu.y) + menu.height)
+        y = (((shifted) ? menu.y_shift : menu.y) +
+             menu.height - item->submenu()->menu.height);
 
       if ((x + item->submenu()->getWidth()) > screen.size().w()) {
-       x = ((shifted) ? menu.x_shift : menu.x) -
-           item->submenu()->getWidth() - screen.getBorderWidth();
+        x = ((shifted) ? menu.x_shift : menu.x) -
+          item->submenu()->getWidth() - screen.getBorderWidth();
       }
-      
+
       if (x < 0) x = 0;
 
       if ((y + item->submenu()->getHeight()) > screen.size().h())
-       y = screen.size().h() - item->submenu()->getHeight() -
-           (screen.getBorderWidth() * 2);
+        y = screen.size().h() - item->submenu()->getHeight() -
+          (screen.getBorderWidth() * 2);
       if (y < 0) y = 0;
-      
+
       item->submenu()->move(x, y);
       if (! moving) drawItem(index, True);
-    
+
       if (! item->submenu()->isVisible())
-       item->submenu()->show();
+        item->submenu()->show();
       item->submenu()->moving = moving;
       which_sub = index;
     } else {
@@ -592,13 +592,13 @@ bool Basemenu::hasSubmenu(int index) {
 
 
 void Basemenu::drawItem(int index, Bool highlight, Bool clear,
-                       int x, int y, unsigned int w, unsigned int h)
+                        int x, int y, unsigned int w, unsigned int h)
 {
   if (index < 0 || index > (signed)menuitems.size()) return;
 
   BasemenuItem *item = menuitems[index];
   if (! item) return;
-  
+
   Bool dotext = True, dohilite = True, dosel = True;
   const char *text = (item->ulabel()) ? *item->ulabel() : item->label();
   int sbl = index / menu.persub, i = index - (sbl * menu.persub);
@@ -606,62 +606,62 @@ void Basemenu::drawItem(int index, Bool highlight, Bool clear,
   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;
   unsigned int hilite_w = menu.item_w, hilite_h = menu.item_h, text_w = 0,
-    text_h = 0;
+  text_h = 0;
   unsigned int half_w = menu.item_h / 2, quarter_w = menu.item_h / 4;
-  
+
   if (text) {
-    if (i18n->multibyte()) {
+    if (i18n.multibyte()) {
       XRectangle ink, logical;
       XmbTextExtents(screen.getMenuStyle()->f_fontset,
-                    text, len, &ink, &logical);
+                     text, len, &ink, &logical);
       text_w = logical.width;
       text_y = item_y + (menu.bevel_w / 2) -
-              screen.getMenuStyle()->f_fontset_extents->max_ink_extent.y;
+        screen.getMenuStyle()->f_fontset_extents->max_ink_extent.y;
     } else {
       text_w = XTextWidth(screen.getMenuStyle()->f_font, text, len);
       text_y =  item_y +
-               screen.getMenuStyle()->f_font->ascent +
-               (menu.bevel_w / 2);
+        screen.getMenuStyle()->f_font->ascent +
+        (menu.bevel_w / 2);
     }
-    
+
     switch(screen.getMenuStyle()->f_justify) {
     case BScreen::LeftJustify:
       text_x = item_x + menu.bevel_w + menu.item_h + 1;
       break;
-      
+
     case BScreen::RightJustify:
       text_x = item_x + menu.item_w - (menu.item_h + menu.bevel_w + text_w);
       break;
-      
+
     case BScreen::CenterJustify:
       text_x = item_x + ((menu.item_w + 1 - text_w) / 2);
       break;
     }
-    
+
     text_h = menu.item_h - menu.bevel_w;
   }
-  
+
   GC gc =
     ((highlight || item->isSelected()) ? screen.getMenuStyle()->h_text_gc :
      screen.getMenuStyle()->f_text_gc),
-    tgc =
+  tgc =
     ((highlight) ? screen.getMenuStyle()->h_text_gc :
      ((item->isEnabled()) ? screen.getMenuStyle()->f_text_gc :
       screen.getMenuStyle()->d_text_gc));
-  
+
   sel_x = item_x;
   if (screen.getMenuStyle()->bullet_pos == Right)
     sel_x += (menu.item_w - menu.item_h - menu.bevel_w);
   sel_x += quarter_w;
   sel_y = item_y + quarter_w;
-  
+
   if (clear) {
     XClearArea(display, menu.frame, item_x, item_y, menu.item_w, menu.item_h,
-              False);
+               False);
   } else if (! (x == y && y == -1 && w == h && h == 0)) {
     // calculate the which part of the hilite to redraw
     if (! (max(item_x, x) <= (signed) min(item_x + menu.item_w, x + w) &&
-          max(item_y, y) <= (signed) min(item_y + menu.item_h, y + h))) {
+           max(item_y, y) <= (signed) min(item_y + menu.item_h, y + h))) {
       dohilite = False;
     } else {
       hilite_x = max(item_x, x);
@@ -671,44 +671,44 @@ void Basemenu::drawItem(int index, Bool highlight, Bool clear,
       hoff_x = hilite_x % menu.item_w;
       hoff_y = hilite_y % menu.item_h;
     }
-    
+
     // check if we need to redraw the text    
     int text_ry = item_y + (menu.bevel_w / 2);
     if (! (max(text_x, x) <= (signed) min(text_x + text_w, x + w) &&
-          max(text_ry, y) <= (signed) min(text_ry + text_h, y + h)))
+           max(text_ry, y) <= (signed) min(text_ry + text_h, y + h)))
       dotext = False;
-    
+
     // check if we need to redraw the select pixmap/menu bullet
     if (! (max(sel_x, x) <= (signed) min(sel_x + half_w, x + w) &&
-          max(sel_y, y) <= (signed) min(sel_y + half_w, y + h)))
+           max(sel_y, y) <= (signed) min(sel_y + half_w, y + h)))
       dosel = False;
   }
-  
+
   if (dohilite && highlight && (menu.hilite_pixmap != ParentRelative)) {
     if (menu.hilite_pixmap)
       XCopyArea(display, menu.hilite_pixmap, menu.frame,
-               screen.getMenuStyle()->hilite_gc, hoff_x, hoff_y,
-               hilite_w, hilite_h, hilite_x, hilite_y);
+                screen.getMenuStyle()->hilite_gc, hoff_x, hoff_y,
+                hilite_w, hilite_h, hilite_x, hilite_y);
     else
       XFillRectangle(display, menu.frame,
-                    screen.getMenuStyle()->hilite_gc,
-                    hilite_x, hilite_y, hilite_w, hilite_h);
+                     screen.getMenuStyle()->hilite_gc,
+                     hilite_x, hilite_y, hilite_w, hilite_h);
   } else if (dosel && item->isSelected() &&
-                        (menu.sel_pixmap != ParentRelative)) {
+             (menu.sel_pixmap != ParentRelative)) {
     if (menu.sel_pixmap)
       XCopyArea(display, menu.sel_pixmap, menu.frame,
-               screen.getMenuStyle()->hilite_gc, 0, 0,
-               half_w, half_w, sel_x, sel_y);
+                screen.getMenuStyle()->hilite_gc, 0, 0,
+                half_w, half_w, sel_x, sel_y);
     else
       XFillRectangle(display, menu.frame,
-                    screen.getMenuStyle()->hilite_gc,
-                    sel_x, sel_y, half_w, half_w);
+                     screen.getMenuStyle()->hilite_gc,
+                     sel_x, sel_y, half_w, half_w);
   }
-  
+
   if (dotext && text) {
-    if (i18n->multibyte())
+    if (i18n.multibyte())
       XmbDrawString(display, menu.frame, screen.getMenuStyle()->f_fontset,
-                   tgc, text_x, text_y, text, len);
+                    tgc, text_x, text_y, text, len);
     else
       XDrawString(display, menu.frame, tgc, text_x, text_y, text, len);
   }
@@ -724,24 +724,24 @@ void Basemenu::drawItem(int index, Bool highlight, Bool clear,
 
       if (screen.getMenuStyle()->bullet_pos == Right) {
         tri[0].x = sel_x + quarter_w - 2;
-       tri[0].y = sel_y + quarter_w - 2;
+        tri[0].y = sel_y + quarter_w - 2;
         tri[1].x = 4;
-       tri[1].y = 2;
+        tri[1].y = 2;
         tri[2].x = -4;
-       tri[2].y = 2;
+        tri[2].y = 2;
       } else {
         tri[0].x = sel_x + quarter_w - 2;
-       tri[0].y = item_y + half_w;
+        tri[0].y = item_y + half_w;
         tri[1].x = 4;
-       tri[1].y = 2;
+        tri[1].y = 2;
         tri[2].x = 0;
-       tri[2].y = -4;
+        tri[2].y = -4;
       }
-      
+
       XFillPolygon(display, menu.frame, gc, tri, 3, Convex,
                    CoordModePrevious);
       break;
-      
+
     case Diamond:
       XPoint dia[4];
 
@@ -825,9 +825,9 @@ void Basemenu::buttonPressEvent(XButtonEvent *be) {
       BasemenuItem *item = menuitems[w];
 
       if (item->submenu())
-       drawSubmenu(w);
+        drawSubmenu(w);
       else
-       drawItem(w, (item->isEnabled()), True);
+        drawItem(w, (item->isEnabled()), True);
     }
   } else {
     menu.x_move = be->x_root - menu.x;
@@ -840,34 +840,34 @@ void Basemenu::buttonReleaseEvent(XButtonEvent *re) {
   if (re->window == menu.title) {
     if (moving) {
       moving = False;
-      
+
       if (which_sub != -1)
-       drawSubmenu(which_sub);
+        drawSubmenu(which_sub);
     }
-    
+
     if (re->x >= 0 && re->x <= (signed) menu.width &&
-       re->y >= 0 && re->y <= (signed) menu.title_h)
+        re->y >= 0 && re->y <= (signed) menu.title_h)
       if (re->button == 3)
-       hide();
+        hide();
   } else if (re->window == menu.frame &&
-            re->x >= 0 && re->x < (signed) menu.width &&
-            re->y >= 0 && re->y < (signed) menu.frame_h) {
+             re->x >= 0 && re->x < (signed) menu.width &&
+             re->y >= 0 && re->y < (signed) menu.frame_h) {
     if (re->button == 3) {
       hide();
     } else {
       int sbl = (re->x / menu.item_w), i = (re->y / menu.item_h),
-          ix = sbl * menu.item_w, iy = i * menu.item_h,
-           w = (sbl * menu.persub) + i,
-           p = (which_sbl * menu.persub) + which_press;
+      ix = sbl * menu.item_w, iy = i * menu.item_h,
+      w = (sbl * menu.persub) + i,
+      p = (which_sbl * menu.persub) + which_press;
 
       if (w < (signed)menuitems.size() && w >= 0) {
-       drawItem(p, (p == which_sub), True);
+        drawItem(p, (p == which_sub), True);
 
         if  (p == w && isItemEnabled(w)) {
-         if (re->x > ix && re->x < (signed) (ix + menu.item_w) &&
-             re->y > iy && re->y < (signed) (iy + menu.item_h)) {
-           itemSelected(re->button, w);
-         }
+          if (re->x > ix && re->x < (signed) (ix + menu.item_w) &&
+              re->y > iy && re->y < (signed) (iy + menu.item_h)) {
+            itemSelected(re->button, w);
+          }
         }
       } else
         drawItem(p, False, True);
@@ -880,44 +880,44 @@ void Basemenu::motionNotifyEvent(XMotionEvent *me) {
   if (me->window == menu.title && (me->state & Button1Mask)) {
     if (movable) {
       if (! moving) {
-       if (parent && (! torn)) {
-         parent->drawItem(parent->which_sub, False, True);
-         parent->which_sub = -1;
-       }
+        if (parent && (! torn)) {
+          parent->drawItem(parent->which_sub, False, True);
+          parent->which_sub = -1;
+        }
 
         moving = torn = True;
 
-       if (which_sub != -1)
-         drawSubmenu(which_sub);
+        if (which_sub != -1)
+          drawSubmenu(which_sub);
       } else {
-       menu.x = me->x_root - menu.x_move,
-       menu.y = me->y_root - menu.y_move;
-       
-       XMoveWindow(display, menu.window, menu.x, menu.y);
-         
-       if (which_sub != -1)
-         drawSubmenu(which_sub);
+        menu.x = me->x_root - menu.x_move,
+        menu.y = me->y_root - menu.y_move;
+
+        XMoveWindow(display, menu.window, menu.x, menu.y);
+
+        if (which_sub != -1)
+          drawSubmenu(which_sub);
       }
     }
   } else if ((! (me->state & Button1Mask)) && me->window == menu.frame &&
-            me->x >= 0 && me->x < (signed) menu.width &&
-            me->y >= 0 && me->y < (signed) menu.frame_h) {
+             me->x >= 0 && me->x < (signed) menu.width &&
+             me->y >= 0 && me->y < (signed) menu.frame_h) {
     int sbl = (me->x / menu.item_w), i = (me->y / menu.item_h),
-         w = (sbl * menu.persub) + i;
+    w = (sbl * menu.persub) + i;
 
     if ((i != which_press || sbl != which_sbl) &&
-       (w < (signed)menuitems.size() && w >= 0)) {
+        (w < (signed)menuitems.size() && w >= 0)) {
       if (which_press != -1 && which_sbl != -1) {
-       int p = (which_sbl * menu.persub) + which_press;
-       BasemenuItem *item = menuitems[p];
-
-       drawItem(p, False, True);
-       if (item->submenu())
-         if (item->submenu()->isVisible() &&
-             (! item->submenu()->isTorn())) {
-           item->submenu()->internal_hide();
-           which_sub = -1;
-         }
+        int p = (which_sbl * menu.persub) + which_press;
+        BasemenuItem *item = menuitems[p];
+
+        drawItem(p, False, True);
+        if (item->submenu())
+          if (item->submenu()->isVisible() &&
+              (! item->submenu()->isTorn())) {
+            item->submenu()->internal_hide();
+            which_sub = -1;
+          }
       }
 
       which_press = i;
@@ -926,9 +926,9 @@ void Basemenu::motionNotifyEvent(XMotionEvent *me) {
       BasemenuItem *itmp = menuitems[w];
 
       if (itmp->submenu())
-       drawSubmenu(w);
+        drawSubmenu(w);
       else
-       drawItem(w, (itmp->isEnabled()), True);
+        drawItem(w, (itmp->isEnabled()), True);
     }
   }
 }
@@ -943,10 +943,10 @@ void Basemenu::exposeEvent(XExposeEvent *ee) {
     // items down in that sublevel
 
     int sbl = (ee->x / menu.item_w), id = (ee->y / menu.item_h),
-      // next... figure out how many sublevels over the redraw spans
-      sbl_d = ((ee->x + ee->width) / menu.item_w),
-      // then we see how many items down to redraw
-      id_d = ((ee->y + ee->height) / menu.item_h);
+    // next... figure out how many sublevels over the redraw spans
+    sbl_d = ((ee->x + ee->width) / menu.item_w),
+    // then we see how many items down to redraw
+    id_d = ((ee->y + ee->height) / menu.item_h);
 
     if (id_d > menu.persub) id_d = menu.persub;
 
@@ -957,10 +957,10 @@ void Basemenu::exposeEvent(XExposeEvent *ee) {
       // set the iterator to the first item in the sublevel needing redrawing
       it = menuitems.begin() + (id + (i * menu.persub));
       for (ii = id; ii <= id_d && it != menuitems.end(); it++, ii++) {
-       int index = ii + (i * menu.persub);
-       // redraw the item
-       drawItem(index, (which_sub == index), False,
-                ee->x, ee->y, ee->width, ee->height);
+        int index = ii + (i * menu.persub);
+        // redraw the item
+        drawItem(index, (which_sub == index), False,
+                 ee->x, ee->y, ee->width, ee->height);
       }
     }
   }
@@ -994,15 +994,15 @@ void Basemenu::enterNotifyEvent(XCrossingEvent *ce) {
     if (which_sub != -1) {
       BasemenuItem *tmp = menuitems[which_sub];
       if (tmp->submenu()->isVisible()) {
-       int sbl = (ce->x / menu.item_w), i = (ce->y / menu.item_h),
-         w = (sbl * menu.persub) + i;
+        int sbl = (ce->x / menu.item_w), i = (ce->y / menu.item_h),
+        w = (sbl * menu.persub) + i;
 
-       if (w != which_sub && (! tmp->submenu()->isTorn())) {
-         tmp->submenu()->internal_hide();
+        if (w != which_sub && (! tmp->submenu()->isTorn())) {
+          tmp->submenu()->internal_hide();
 
-         drawItem(which_sub, False, True);
-         which_sub = -1;
-       }
+          drawItem(which_sub, False, True);
+          which_sub = -1;
+        }
       }
     }
   }
@@ -1031,9 +1031,9 @@ void Basemenu::leaveNotifyEvent(XCrossingEvent *ce) {
 
 void Basemenu::reconfigure(void) {
   XSetWindowBackground(display, menu.window,
-                      screen.getBorderColor()->getPixel());
+                       screen.getBorderColor()->getPixel());
   XSetWindowBorder(display, menu.window,
-                  screen.getBorderColor()->getPixel());
+                   screen.getBorderColor()->getPixel());
   XSetWindowBorderWidth(display, menu.window, screen.getBorderWidth());
 
   menu.bevel_w = screen.getBevelWidth();
This page took 0.049958 seconds and 4 git commands to generate.