From b0acf2e560bba0bdbf0134786160b99297b6bc82 Mon Sep 17 00:00:00 2001 From: shaleh Date: Mon, 4 Mar 2002 02:06:51 +0000 Subject: [PATCH] removed all tab chars from source --- src/Basemenu.cc | 220 +++++------ src/Basemenu.hh | 8 +- src/Configmenu.cc | 16 +- src/Image.cc | 480 +++++++++++------------ src/Image.hh | 34 +- src/LinkedList.cc | 395 ++++++++++++------- src/Rootmenu.cc | 4 +- src/Screen.cc | 890 +++++++++++++++++++++---------------------- src/Slit.cc | 80 ++-- src/Timer.cc | 2 +- src/Toolbar.cc | 312 +++++++-------- src/Window.cc | 536 +++++++++++++------------- src/Window.hh | 4 +- src/Windowmenu.cc | 18 +- src/Workspace.cc | 50 +-- src/Workspacemenu.cc | 2 +- src/blackbox.cc | 330 ++++++++-------- src/main.cc | 44 +-- 18 files changed, 1773 insertions(+), 1652 deletions(-) diff --git a/src/Basemenu.cc b/src/Basemenu.cc index b1e3a998..441e9651 100644 --- a/src/Basemenu.cc +++ b/src/Basemenu.cc @@ -131,16 +131,16 @@ Basemenu::Basemenu(BScreen *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); blackbox->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); blackbox->saveMenuSearch(menu.frame, this); menuitems = new LinkedList; @@ -233,9 +233,9 @@ 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(); } } @@ -295,7 +295,7 @@ void Basemenu::update(void) { LinkedListIterator it(menuitems); for (BasemenuItem *tmp = it.current(); tmp; it++, tmp = it.current()) { const char *s = ((tmp->u && *tmp->u) ? *tmp->u : - ((tmp->l) ? tmp->l : (const char *) 0)); + ((tmp->l) ? tmp->l : (const char *) 0)); int l = strlen(s); if (i18n.multibyte()) { @@ -314,8 +314,8 @@ void Basemenu::update(void) { menu.sublevels = 1; while (((menu.item_h * (menuitems->count() + 1) / menu.sublevels) - + menu.title_h + screen->getBorderWidth()) > - screen->getHeight()) + + menu.title_h + screen->getBorderWidth()) > + screen->getHeight()) menu.sublevels++; if (menu.sublevels < menu.minsub) menu.sublevels = menu.minsub; @@ -344,7 +344,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); @@ -359,7 +359,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); @@ -393,9 +393,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); @@ -477,7 +477,7 @@ void Basemenu::move(int x, int y) { void Basemenu::redrawTitle(void) { char *text = (char *) ((menu.label) ? menu.label : - i18n(BasemenuSet, BasemenuBlackboxMenu, + i18n(BasemenuSet, BasemenuBlackboxMenu, "Blackbox Menu")); int dx = menu.bevel_w, len = strlen(text); unsigned int l; @@ -506,11 +506,11 @@ void Basemenu::redrawTitle(void) { MenuStyle *style = screen->getMenuStyle(); 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); } @@ -525,39 +525,39 @@ void Basemenu::drawSubmenu(int index) { if (index >= 0 && index < menuitems->count()) { BasemenuItem *item = menuitems->find(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; 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->getWidth()) { - x = ((shifted) ? menu.x_shift : menu.x) - + x = ((shifted) ? menu.x_shift : menu.x) - item->submenu()->getWidth() - screen->getBorderWidth(); } if (x < 0) x = 0; if ((y + item->submenu()->getHeight()) > screen->getHeight()) - y = screen->getHeight() - item->submenu()->getHeight() - + y = screen->getHeight() - item->submenu()->getHeight() - (screen->getBorderWidth() * 2); if (y < 0) y = 0; @@ -565,7 +565,7 @@ void Basemenu::drawSubmenu(int index) { if (! moving) drawItem(index, True); if (! item->submenu()->isVisible()) - item->submenu()->show(); + item->submenu()->show(); item->submenu()->moving = moving; which_sub = index; } else { @@ -585,7 +585,7 @@ 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 > menuitems->count()) return; @@ -606,7 +606,7 @@ void Basemenu::drawItem(int index, Bool highlight, Bool clear, 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; @@ -650,11 +650,11 @@ void Basemenu::drawItem(int index, Bool highlight, Bool clear, 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); @@ -668,40 +668,40 @@ void Basemenu::drawItem(int index, Bool highlight, Bool clear, // 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)) { 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()) 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); } @@ -717,18 +717,18 @@ 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, @@ -818,9 +818,9 @@ void Basemenu::buttonPressEvent(XButtonEvent *be) { BasemenuItem *item = menuitems->find(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; @@ -835,16 +835,16 @@ void Basemenu::buttonReleaseEvent(XButtonEvent *re) { 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 { @@ -854,13 +854,13 @@ void Basemenu::buttonReleaseEvent(XButtonEvent *re) { p = (which_sbl * menu.persub) + which_press; if (w < menuitems->count() && 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); @@ -873,44 +873,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.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); + + 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; if ((i != which_press || sbl != which_sbl) && - (w < menuitems->count() && w >= 0)) { + (w < menuitems->count() && w >= 0)) { if (which_press != -1 && which_sbl != -1) { - int p = (which_sbl * menu.persub) + which_press; - BasemenuItem *item = menuitems->find(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->find(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; @@ -919,9 +919,9 @@ void Basemenu::motionNotifyEvent(XMotionEvent *me) { BasemenuItem *itmp = menuitems->find(w); if (itmp->submenu()) - drawSubmenu(w); + drawSubmenu(w); else - drawItem(w, (itmp->isEnabled()), True); + drawItem(w, (itmp->isEnabled()), True); } } } @@ -950,10 +950,10 @@ void Basemenu::exposeEvent(XExposeEvent *ee) { // set the iterator to the first item in the sublevel needing redrawing it.set(id + (i * menu.persub)); for (ii = id; ii <= id_d && it.current(); 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); } } } @@ -987,15 +987,15 @@ void Basemenu::enterNotifyEvent(XCrossingEvent *ce) { if (which_sub != -1) { BasemenuItem *tmp = menuitems->find(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; + } } } } @@ -1024,9 +1024,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(); diff --git a/src/Basemenu.hh b/src/Basemenu.hh index ddfb0130..f232af1b 100644 --- a/src/Basemenu.hh +++ b/src/Basemenu.hh @@ -68,8 +68,8 @@ protected: virtual void itemSelected(int, int) = 0; virtual void drawItem(int, Bool = False, Bool = False, - int = -1, int = -1, unsigned int = 0, - unsigned int = 0); + int = -1, int = -1, unsigned int = 0, + unsigned int = 0); virtual void redrawTitle(); virtual void internal_hide(void); @@ -150,10 +150,10 @@ public: s(0), u(0), l(lp), e(ep), f(fp), enabled(1), selected(0) {} BasemenuItem(const char *lp, Basemenu *mp): s(mp), u(0), l(lp), e(0), f(0), - enabled(1), selected(0) {} + enabled(1), selected(0) {} BasemenuItem(const char **up, int fp): s(0), u(up), l(0), e(0), f(fp), - enabled(1), selected(0) {} + enabled(1), selected(0) {} inline const char *exec(void) const { return e; } inline const char *label(void) const { return l; } diff --git a/src/Configmenu.cc b/src/Configmenu.cc index 6533c39b..86babd8d 100644 --- a/src/Configmenu.cc +++ b/src/Configmenu.cc @@ -161,13 +161,13 @@ void Configmenu::Focusmenu::itemSelected(int button, int index) { if (! configmenu->screen->getBlackbox()->getFocusedWindow()) XSetInputFocus(configmenu->screen->getBlackbox()->getXDisplay(), - configmenu->screen->getToolbar()->getWindowID(), - RevertToParent, CurrentTime); + configmenu->screen->getToolbar()->getWindowID(), + RevertToParent, CurrentTime); else XSetInputFocus(configmenu->screen->getBlackbox()->getXDisplay(), - configmenu->screen->getBlackbox()-> - getFocusedWindow()->getClientWindow(), - RevertToParent, CurrentTime); + configmenu->screen->getBlackbox()-> + getFocusedWindow()->getClientWindow(), + RevertToParent, CurrentTime); configmenu->screen->reconfigure(); @@ -203,10 +203,10 @@ Configmenu::Placementmenu::Placementmenu(Configmenu *cm) : insert(i18n(ConfigmenuSet, ConfigmenuSmartRows, "Smart Placement (Rows)"), - BScreen::RowSmartPlacement); + BScreen::RowSmartPlacement); insert(i18n(ConfigmenuSet, ConfigmenuSmartCols, "Smart Placement (Columns)"), - BScreen::ColSmartPlacement); + BScreen::ColSmartPlacement); insert(i18n(ConfigmenuSet, ConfigmenuCascade, "Cascade Placement"), BScreen::CascadePlacement); insert(i18n(ConfigmenuSet, ConfigmenuLeftRight, @@ -234,7 +234,7 @@ Configmenu::Placementmenu::Placementmenu(Configmenu *cm) : } Bool rl = (configmenu->screen->getRowPlacementDirection() == - BScreen::LeftRight), + BScreen::LeftRight), tb = (configmenu->screen->getColPlacementDirection() == BScreen::TopBottom); diff --git a/src/Image.cc b/src/Image.cc index bd13ebe5..d8074efb 100644 --- a/src/Image.cc +++ b/src/Image.cc @@ -147,18 +147,18 @@ Pixmap BImage::render_solid(BTexture *texture) { GCForeground, &gcv); XFillRectangle(control->getBaseDisplay()->getXDisplay(), pixmap, gc, 0, 0, - width, height); + width, height); #ifdef INTERLACE if (texture->getTexture() & BImage_Interlaced) { gcv.foreground = texture->getColorTo()->getPixel(); GC igc = XCreateGC(control->getBaseDisplay()->getXDisplay(), pixmap, - GCForeground, &gcv); + GCForeground, &gcv); register unsigned int i = 0; for (; i < height; i += 2) XDrawLine(control->getBaseDisplay()->getXDisplay(), pixmap, igc, - 0, i, width, i); + 0, i, width, i); XFreeGC(control->getBaseDisplay()->getXDisplay(), igc); } @@ -269,7 +269,7 @@ XImage *BImage::renderXImage(void) { if (! image) { fprintf(stderr, i18n(ImageSet, ImageErrorCreatingXImage, - "BImage::renderXImage: error creating XImage\n")); + "BImage::renderXImage: error creating XImage\n")); return (XImage *) 0; } @@ -307,9 +307,9 @@ XImage *BImage::renderXImage(void) { // (raster@rasterman.com) for telling me about this... portions of this // code is based off of his code in Imlib for (y = 0, offset = 0; y < height; y++) { - dithy = y & 0x3; + dithy = y & 0x3; - for (x = 0; x < width; x++, offset++) { + for (x = 0; x < width; x++, offset++) { dithx = x & 0x3; r = red[offset]; g = green[offset]; @@ -327,28 +327,28 @@ XImage *BImage::renderXImage(void) { if ((dither4[dithy][dithx] < eg) && (g < green_table[255])) g++; if ((dither4[dithy][dithx] < eb) && (b < blue_table[255])) b++; - pixel = (r << red_offset) | (g << green_offset) | (b << blue_offset); + pixel = (r << red_offset) | (g << green_offset) | (b << blue_offset); switch (o) { - case 8: // 8bpp - *pixel_data++ = pixel; - break; + case 8: // 8bpp + *pixel_data++ = pixel; + break; case 16: // 16bpp LSB *pixel_data++ = pixel; - *pixel_data++ = pixel >> 8; + *pixel_data++ = pixel >> 8; break; case 17: // 16bpp MSB - *pixel_data++ = pixel >> 8; - *pixel_data++ = pixel; + *pixel_data++ = pixel >> 8; + *pixel_data++ = pixel; break; - case 24: // 24bpp LSB - *pixel_data++ = pixel; - *pixel_data++ = pixel >> 8; - *pixel_data++ = pixel >> 16; - break; + case 24: // 24bpp LSB + *pixel_data++ = pixel; + *pixel_data++ = pixel >> 8; + *pixel_data++ = pixel >> 16; + break; case 25: // 24bpp MSB *pixel_data++ = pixel >> 16; @@ -370,9 +370,9 @@ XImage *BImage::renderXImage(void) { *pixel_data++ = pixel; break; } - } + } - pixel_data = (ppixel_data += image->bytes_per_line); + pixel_data = (ppixel_data += image->bytes_per_line); } break; @@ -381,19 +381,19 @@ XImage *BImage::renderXImage(void) { case PseudoColor: { #ifndef ORDEREDPSEUDO short *terr, - *rerr = new short[width + 2], - *gerr = new short[width + 2], - *berr = new short[width + 2], - *nrerr = new short[width + 2], - *ngerr = new short[width + 2], - *nberr = new short[width + 2]; + *rerr = new short[width + 2], + *gerr = new short[width + 2], + *berr = new short[width + 2], + *nrerr = new short[width + 2], + *ngerr = new short[width + 2], + *nberr = new short[width + 2]; int rr, gg, bb, rer, ger, ber; int dd = 255 / control->getColorsPerChannel(); for (x = 0; x < width; x++) { - *(rerr + x) = *(red + x); - *(gerr + x) = *(green + x); - *(berr + x) = *(blue + x); + *(rerr + x) = *(red + x); + *(gerr + x) = *(green + x); + *(berr + x) = *(blue + x); } *(rerr + x) = *(gerr + x) = *(berr + x) = 0; @@ -430,47 +430,47 @@ XImage *BImage::renderXImage(void) { } #else // !ORDEREDPSEUDO if (y < (height - 1)) { - int i = offset + width; - for (x = 0; x < width; x++, i++) { - *(nrerr + x) = *(red + i); - *(ngerr + x) = *(green + i); - *(nberr + x) = *(blue + i); - } - - *(nrerr + x) = *(red + (--i)); - *(ngerr + x) = *(green + i); - *(nberr + x) = *(blue + i); + int i = offset + width; + for (x = 0; x < width; x++, i++) { + *(nrerr + x) = *(red + i); + *(ngerr + x) = *(green + i); + *(nberr + x) = *(blue + i); + } + + *(nrerr + x) = *(red + (--i)); + *(ngerr + x) = *(green + i); + *(nberr + x) = *(blue + i); } for (x = 0; x < width; x++) { - rr = rerr[x]; - gg = gerr[x]; - bb = berr[x]; - - if (rr > 255) rr = 255; else if (rr < 0) rr = 0; - if (gg > 255) gg = 255; else if (gg < 0) gg = 0; - if (bb > 255) bb = 255; else if (bb < 0) bb = 0; - - r = red_table[rr]; - g = green_table[gg]; - b = blue_table[bb]; - - rer = rerr[x] - r*dd; - ger = gerr[x] - g*dd; - ber = berr[x] - b*dd; - - pixel = (r * cpccpc) + (g * cpc) + b; - *pixel_data++ = colors[pixel].pixel; - - r = rer >> 1; - g = ger >> 1; - b = ber >> 1; - rerr[x+1] += r; - gerr[x+1] += g; - berr[x+1] += b; - nrerr[x] += r; - ngerr[x] += g; - nberr[x] += b; + rr = rerr[x]; + gg = gerr[x]; + bb = berr[x]; + + if (rr > 255) rr = 255; else if (rr < 0) rr = 0; + if (gg > 255) gg = 255; else if (gg < 0) gg = 0; + if (bb > 255) bb = 255; else if (bb < 0) bb = 0; + + r = red_table[rr]; + g = green_table[gg]; + b = blue_table[bb]; + + rer = rerr[x] - r*dd; + ger = gerr[x] - g*dd; + ber = berr[x] - b*dd; + + pixel = (r * cpccpc) + (g * cpc) + b; + *pixel_data++ = colors[pixel].pixel; + + r = rer >> 1; + g = ger >> 1; + b = ber >> 1; + rerr[x+1] += r; + gerr[x+1] += g; + berr[x+1] += b; + nrerr[x] += r; + ngerr[x] += g; + nberr[x] += b; } offset += width; @@ -502,7 +502,7 @@ XImage *BImage::renderXImage(void) { default: fprintf(stderr, i18n(ImageSet, ImageUnsupVisual, - "BImage::renderXImage: unsupported visual\n")); + "BImage::renderXImage: unsupported visual\n")); delete [] d; XDestroyImage(image); return (XImage *) 0; @@ -513,12 +513,12 @@ XImage *BImage::renderXImage(void) { case PseudoColor: for (y = 0, offset = 0; y < height; y++) { for (x = 0; x < width; x++, offset++) { - r = red_table[red[offset]]; + r = red_table[red[offset]]; g = green_table[green[offset]]; - b = blue_table[blue[offset]]; + b = blue_table[blue[offset]]; - pixel = (r * cpccpc) + (g * cpc) + b; - *pixel_data++ = colors[pixel].pixel; + pixel = (r * cpccpc) + (g * cpc) + b; + *pixel_data++ = colors[pixel].pixel; } pixel_data = (ppixel_data += image->bytes_per_line); @@ -529,16 +529,16 @@ XImage *BImage::renderXImage(void) { case TrueColor: for (y = 0, offset = 0; y < height; y++) { for (x = 0; x < width; x++, offset++) { - r = red_table[red[offset]]; - g = green_table[green[offset]]; - b = blue_table[blue[offset]]; + r = red_table[red[offset]]; + g = green_table[green[offset]]; + b = blue_table[blue[offset]]; - pixel = (r << red_offset) | (g << green_offset) | (b << blue_offset); + pixel = (r << red_offset) | (g << green_offset) | (b << blue_offset); switch (o) { - case 8: // 8bpp - *pixel_data++ = pixel; - break; + case 8: // 8bpp + *pixel_data++ = pixel; + break; case 16: // 16bpp LSB *pixel_data++ = pixel; @@ -587,12 +587,12 @@ XImage *BImage::renderXImage(void) { case GrayScale: for (y = 0, offset = 0; y < height; y++) { for (x = 0; x < width; x++, offset++) { - r = *(red_table + *(red + offset)); - g = *(green_table + *(green + offset)); - b = *(blue_table + *(blue + offset)); + r = *(red_table + *(red + offset)); + g = *(green_table + *(green + offset)); + b = *(blue_table + *(blue + offset)); - g = ((r * 30) + (g * 59) + (b * 11)) / 100; - *pixel_data++ = colors[g].pixel; + g = ((r * 30) + (g * 59) + (b * 11)) / 100; + *pixel_data++ = colors[g].pixel; } pixel_data = (ppixel_data += image->bytes_per_line); @@ -602,7 +602,7 @@ XImage *BImage::renderXImage(void) { default: fprintf(stderr, i18n(ImageSet, ImageUnsupVisual, - "BImage::renderXImage: unsupported visual\n")); + "BImage::renderXImage: unsupported visual\n")); delete [] d; XDestroyImage(image); return (XImage *) 0; @@ -621,7 +621,7 @@ Pixmap BImage::renderPixmap(void) { if (pixmap == None) { fprintf(stderr, i18n(ImageSet, ImageErrorCreatingPixmap, - "BImage::renderPixmap: error creating pixmap\n")); + "BImage::renderPixmap: error creating pixmap\n")); return None; } @@ -637,8 +637,8 @@ Pixmap BImage::renderPixmap(void) { } XPutImage(control->getBaseDisplay()->getXDisplay(), pixmap, - DefaultGC(control->getBaseDisplay()->getXDisplay(), - control->getScreenInfo()->getScreenNumber()), + DefaultGC(control->getBaseDisplay()->getXDisplay(), + control->getScreenInfo()->getScreenNumber()), image, 0, 0, 0, 0, width, height); if (image->data) { @@ -1799,8 +1799,8 @@ BImageControl::BImageControl(BaseDisplay *dpy, ScreenInfo *scrn, Bool _dither, bits_per_pixel = 0; for (int i = 0; i < count; i++) if (pmv[i].depth == screen_depth) { - bits_per_pixel = pmv[i].bits_per_pixel; - break; + bits_per_pixel = pmv[i].bits_per_pixel; + break; } XFree(pmv); @@ -1830,7 +1830,7 @@ BImageControl::BImageControl(BaseDisplay *dpy, ScreenInfo *scrn, Bool _dither, blue_bits = 255 / blue_mask; for (i = 0; i < 256; i++) { - red_color_table[i] = i / red_bits; + red_color_table[i] = i / red_bits; green_color_table[i] = i / green_bits; blue_color_table[i] = i / blue_bits; } @@ -1844,14 +1844,14 @@ BImageControl::BImageControl(BaseDisplay *dpy, ScreenInfo *scrn, Bool _dither, ncolors = colors_per_channel * colors_per_channel * colors_per_channel; if (ncolors > (1 << screen_depth)) { - colors_per_channel = (1 << screen_depth) / 3; - ncolors = colors_per_channel * colors_per_channel * colors_per_channel; + colors_per_channel = (1 << screen_depth) / 3; + ncolors = colors_per_channel * colors_per_channel * colors_per_channel; } if (colors_per_channel < 2 || ncolors > (1 << screen_depth)) { - fprintf(stderr, i18n(ImageSet, ImageInvalidColormapSize, + fprintf(stderr, i18n(ImageSet, ImageInvalidColormapSize, "BImageControl::BImageControl: invalid colormap size %d " - "(%d/%d/%d) - reducing"), + "(%d/%d/%d) - reducing"), ncolors, colors_per_channel, colors_per_channel, colors_per_channel); @@ -1860,11 +1860,11 @@ BImageControl::BImageControl(BaseDisplay *dpy, ScreenInfo *scrn, Bool _dither, colors = new XColor[ncolors]; if (! colors) { - fprintf(stderr, i18n(ImageSet, - ImageErrorAllocatingColormap, - "BImageControl::BImageControl: error allocating " - "colormap\n")); - exit(1); + fprintf(stderr, i18n(ImageSet, + ImageErrorAllocatingColormap, + "BImageControl::BImageControl: error allocating " + "colormap\n")); + exit(1); } int i = 0, ii, p, r, g, b, @@ -1878,63 +1878,63 @@ BImageControl::BImageControl(BaseDisplay *dpy, ScreenInfo *scrn, Bool _dither, red_bits = green_bits = blue_bits = bits; for (i = 0; i < 256; i++) - red_color_table[i] = green_color_table[i] = blue_color_table[i] = - i / bits; + red_color_table[i] = green_color_table[i] = blue_color_table[i] = + i / bits; for (r = 0, i = 0; r < colors_per_channel; r++) - for (g = 0; g < colors_per_channel; g++) - for (b = 0; b < colors_per_channel; b++, i++) { - colors[i].red = (r * 0xffff) / (colors_per_channel - 1); - colors[i].green = (g * 0xffff) / (colors_per_channel - 1); - colors[i].blue = (b * 0xffff) / (colors_per_channel - 1);; - colors[i].flags = DoRed|DoGreen|DoBlue; - } + for (g = 0; g < colors_per_channel; g++) + for (b = 0; b < colors_per_channel; b++, i++) { + colors[i].red = (r * 0xffff) / (colors_per_channel - 1); + colors[i].green = (g * 0xffff) / (colors_per_channel - 1); + colors[i].blue = (b * 0xffff) / (colors_per_channel - 1);; + colors[i].flags = DoRed|DoGreen|DoBlue; + } for (i = 0; i < ncolors; i++) - if (! XAllocColor(basedisplay->getXDisplay(), colormap, &colors[i])) { - fprintf(stderr, i18n(ImageSet, ImageColorAllocFail, - "couldn't alloc color %i %i %i\n"), - colors[i].red, colors[i].green, colors[i].blue); - colors[i].flags = 0; - } else - colors[i].flags = DoRed|DoGreen|DoBlue; + if (! XAllocColor(basedisplay->getXDisplay(), colormap, &colors[i])) { + fprintf(stderr, i18n(ImageSet, ImageColorAllocFail, + "couldn't alloc color %i %i %i\n"), + colors[i].red, colors[i].green, colors[i].blue); + colors[i].flags = 0; + } else + colors[i].flags = DoRed|DoGreen|DoBlue; XColor icolors[256]; int incolors = (((1 << screen_depth) > 256) ? 256 : (1 << screen_depth)); for (i = 0; i < incolors; i++) - icolors[i].pixel = i; + icolors[i].pixel = i; XQueryColors(basedisplay->getXDisplay(), colormap, icolors, incolors); for (i = 0; i < ncolors; i++) { - if (! colors[i].flags) { - unsigned long chk = 0xffffffff, pixel, close = 0; - - p = 2; - while (p--) { - for (ii = 0; ii < incolors; ii++) { - r = (colors[i].red - icolors[i].red) >> 8; - g = (colors[i].green - icolors[i].green) >> 8; - b = (colors[i].blue - icolors[i].blue) >> 8; - pixel = (r * r) + (g * g) + (b * b); - - if (pixel < chk) { - chk = pixel; - close = ii; - } - - colors[i].red = icolors[close].red; - colors[i].green = icolors[close].green; - colors[i].blue = icolors[close].blue; - - if (XAllocColor(basedisplay->getXDisplay(), colormap, - &colors[i])) { - colors[i].flags = DoRed|DoGreen|DoBlue; - break; - } - } - } - } + if (! colors[i].flags) { + unsigned long chk = 0xffffffff, pixel, close = 0; + + p = 2; + while (p--) { + for (ii = 0; ii < incolors; ii++) { + r = (colors[i].red - icolors[i].red) >> 8; + g = (colors[i].green - icolors[i].green) >> 8; + b = (colors[i].blue - icolors[i].blue) >> 8; + pixel = (r * r) + (g * g) + (b * b); + + if (pixel < chk) { + chk = pixel; + close = ii; + } + + colors[i].red = icolors[close].red; + colors[i].green = icolors[close].green; + colors[i].blue = icolors[close].blue; + + if (XAllocColor(basedisplay->getXDisplay(), colormap, + &colors[i])) { + colors[i].flags = DoRed|DoGreen|DoBlue; + break; + } + } + } + } } break; @@ -1945,96 +1945,96 @@ BImageControl::BImageControl(BaseDisplay *dpy, ScreenInfo *scrn, Bool _dither, { if (getVisual()->c_class == StaticGray) { - ncolors = 1 << screen_depth; + ncolors = 1 << screen_depth; } else { - ncolors = colors_per_channel * colors_per_channel * colors_per_channel; + ncolors = colors_per_channel * colors_per_channel * colors_per_channel; - if (ncolors > (1 << screen_depth)) { - colors_per_channel = (1 << screen_depth) / 3; - ncolors = - colors_per_channel * colors_per_channel * colors_per_channel; - } + if (ncolors > (1 << screen_depth)) { + colors_per_channel = (1 << screen_depth) / 3; + ncolors = + colors_per_channel * colors_per_channel * colors_per_channel; + } } if (colors_per_channel < 2 || ncolors > (1 << screen_depth)) { - fprintf(stderr, i18n(ImageSet, ImageInvalidColormapSize, + fprintf(stderr, i18n(ImageSet, ImageInvalidColormapSize, "BImageControl::BImageControl: invalid colormap size %d " - "(%d/%d/%d) - reducing"), - ncolors, colors_per_channel, colors_per_channel, - colors_per_channel); + "(%d/%d/%d) - reducing"), + ncolors, colors_per_channel, colors_per_channel, + colors_per_channel); - colors_per_channel = (1 << screen_depth) / 3; + colors_per_channel = (1 << screen_depth) / 3; } colors = new XColor[ncolors]; if (! colors) { - fprintf(stderr, i18n(ImageSet, - ImageErrorAllocatingColormap, - "BImageControl::BImageControl: error allocating " - "colormap\n")); - exit(1); + fprintf(stderr, i18n(ImageSet, + ImageErrorAllocatingColormap, + "BImageControl::BImageControl: error allocating " + "colormap\n")); + exit(1); } int i = 0, ii, p, bits = 255 / (colors_per_channel - 1); red_bits = green_bits = blue_bits = bits; for (i = 0; i < 256; i++) - red_color_table[i] = green_color_table[i] = blue_color_table[i] = - i / bits; + red_color_table[i] = green_color_table[i] = blue_color_table[i] = + i / bits; for (i = 0; i < ncolors; i++) { - colors[i].red = (i * 0xffff) / (colors_per_channel - 1); - colors[i].green = (i * 0xffff) / (colors_per_channel - 1); - colors[i].blue = (i * 0xffff) / (colors_per_channel - 1);; - colors[i].flags = DoRed|DoGreen|DoBlue; - - if (! XAllocColor(basedisplay->getXDisplay(), colormap, - &colors[i])) { - fprintf(stderr, i18n(ImageSet, ImageColorAllocFail, - "couldn't alloc color %i %i %i\n"), - colors[i].red, colors[i].green, colors[i].blue); - colors[i].flags = 0; - } else - colors[i].flags = DoRed|DoGreen|DoBlue; + colors[i].red = (i * 0xffff) / (colors_per_channel - 1); + colors[i].green = (i * 0xffff) / (colors_per_channel - 1); + colors[i].blue = (i * 0xffff) / (colors_per_channel - 1);; + colors[i].flags = DoRed|DoGreen|DoBlue; + + if (! XAllocColor(basedisplay->getXDisplay(), colormap, + &colors[i])) { + fprintf(stderr, i18n(ImageSet, ImageColorAllocFail, + "couldn't alloc color %i %i %i\n"), + colors[i].red, colors[i].green, colors[i].blue); + colors[i].flags = 0; + } else + colors[i].flags = DoRed|DoGreen|DoBlue; } XColor icolors[256]; int incolors = (((1 << screen_depth) > 256) ? 256 : - (1 << screen_depth)); + (1 << screen_depth)); for (i = 0; i < incolors; i++) - icolors[i].pixel = i; + icolors[i].pixel = i; XQueryColors(basedisplay->getXDisplay(), colormap, icolors, incolors); for (i = 0; i < ncolors; i++) { - if (! colors[i].flags) { - unsigned long chk = 0xffffffff, pixel, close = 0; - - p = 2; - while (p--) { - for (ii = 0; ii < incolors; ii++) { - int r = (colors[i].red - icolors[i].red) >> 8; - int g = (colors[i].green - icolors[i].green) >> 8; - int b = (colors[i].blue - icolors[i].blue) >> 8; - pixel = (r * r) + (g * g) + (b * b); - - if (pixel < chk) { - chk = pixel; - close = ii; - } - - colors[i].red = icolors[close].red; - colors[i].green = icolors[close].green; - colors[i].blue = icolors[close].blue; - - if (XAllocColor(basedisplay->getXDisplay(), colormap, - &colors[i])) { - colors[i].flags = DoRed|DoGreen|DoBlue; - break; - } - } - } - } + if (! colors[i].flags) { + unsigned long chk = 0xffffffff, pixel, close = 0; + + p = 2; + while (p--) { + for (ii = 0; ii < incolors; ii++) { + int r = (colors[i].red - icolors[i].red) >> 8; + int g = (colors[i].green - icolors[i].green) >> 8; + int b = (colors[i].blue - icolors[i].blue) >> 8; + pixel = (r * r) + (g * g) + (b * b); + + if (pixel < chk) { + chk = pixel; + close = ii; + } + + colors[i].red = icolors[close].red; + colors[i].green = icolors[close].green; + colors[i].blue = icolors[close].blue; + + if (XAllocColor(basedisplay->getXDisplay(), colormap, + &colors[i])) { + colors[i].flags = DoRed|DoGreen|DoBlue; + break; + } + } + } + } } break; @@ -2043,7 +2043,7 @@ BImageControl::BImageControl(BaseDisplay *dpy, ScreenInfo *scrn, Bool _dither, default: fprintf(stderr, i18n(ImageSet, ImageUnsupVisual, "BImageControl::BImageControl: unsupported visual %d\n"), - getVisual()->c_class); + getVisual()->c_class); exit(1); } @@ -2079,8 +2079,8 @@ BImageControl::~BImageControl(void) { if (cache->count()) { int i, n = cache->count(); fprintf(stderr, i18n(ImageSet, ImagePixmapRelease, - "BImageContol::~BImageControl: pixmap cache - " - "releasing %d pixmaps\n"), n); + "BImageContol::~BImageControl: pixmap cache - " + "releasing %d pixmaps\n"), n); for (i = 0; i < n; i++) { Cache *tmp = cache->first(); @@ -2102,8 +2102,8 @@ BImageControl::~BImageControl(void) { Pixmap BImageControl::searchCache(unsigned int width, unsigned int height, - unsigned long texture, - BColor *c1, BColor *c2) { + unsigned long texture, + BColor *c1, BColor *c2) { if (cache->count()) { LinkedListIterator it(cache); @@ -2131,7 +2131,7 @@ Pixmap BImageControl::renderImage(unsigned int width, unsigned int height, if (texture->getTexture() & BImage_ParentRelative) return ParentRelative; Pixmap pixmap = searchCache(width, height, texture->getTexture(), - texture->getColor(), texture->getColorTo()); + texture->getColor(), texture->getColorTo()); if (pixmap) return pixmap; BImage image(this, width, height); @@ -2177,16 +2177,16 @@ void BImageControl::removeImage(Pixmap pixmap) { for (Cache *tmp = it.current(); tmp; it++, tmp = it.current()) { if (tmp->pixmap == pixmap) { if (tmp->count) { - tmp->count--; + tmp->count--; #ifdef TIMEDCACHE - if (! timer) timeout(); + if (! timer) timeout(); #else // !TIMEDCACHE - if (! tmp->count) timeout(); + if (! tmp->count) timeout(); #endif // TIMEDCACHE } - return; + return; } } } @@ -2194,18 +2194,18 @@ void BImageControl::removeImage(Pixmap pixmap) { unsigned long BImageControl::getColor(const char *colorname, - unsigned char *r, unsigned char *g, - unsigned char *b) + unsigned char *r, unsigned char *g, + unsigned char *b) { XColor color; color.pixel = 0; if (! XParseColor(basedisplay->getXDisplay(), colormap, colorname, &color)) fprintf(stderr, "BImageControl::getColor: color parse error: \"%s\"\n", - colorname); + colorname); else if (! XAllocColor(basedisplay->getXDisplay(), colormap, &color)) fprintf(stderr, "BImageControl::getColor: color alloc error: \"%s\"\n", - colorname); + colorname); if (color.red == 65535) *r = 0xff; else *r = (unsigned char) (color.red / 0xff); @@ -2224,18 +2224,18 @@ unsigned long BImageControl::getColor(const char *colorname) { if (! XParseColor(basedisplay->getXDisplay(), colormap, colorname, &color)) fprintf(stderr, "BImageControl::getColor: color parse error: \"%s\"\n", - colorname); + colorname); else if (! XAllocColor(basedisplay->getXDisplay(), colormap, &color)) fprintf(stderr, "BImageControl::getColor: color alloc error: \"%s\"\n", - colorname); + colorname); return color.pixel; } void BImageControl::getColorTables(unsigned char **rmt, unsigned char **gmt, - unsigned char **bmt, - int *roff, int *goff, int *boff, + unsigned char **bmt, + int *roff, int *goff, int *boff, int *rbit, int *gbit, int *bbit) { if (rmt) *rmt = red_color_table; if (gmt) *gmt = green_color_table; @@ -2258,9 +2258,9 @@ void BImageControl::getXColorTable(XColor **c, int *n) { void BImageControl::getGradientBuffers(unsigned int w, - unsigned int h, - unsigned int **xbuf, - unsigned int **ybuf) + unsigned int h, + unsigned int **xbuf, + unsigned int **ybuf) { if (w > grad_buffer_width) { if (grad_xbuffer) { @@ -2296,7 +2296,7 @@ void BImageControl::installRootColormap(void) { if (cmaps) { for (i = 0; i < ncmap; i++) if (*(cmaps + i) == colormap) - install = False; + install = False; if (install) XInstallColormap(basedisplay->getXDisplay(), colormap); @@ -2350,23 +2350,23 @@ void BImageControl::parseTexture(BTexture *texture, char *t) { else if (strstr(ts, "gradient")) { texture->addTexture(BImage_Gradient); if (strstr(ts, "crossdiagonal")) - texture->addTexture(BImage_CrossDiagonal); + texture->addTexture(BImage_CrossDiagonal); else if (strstr(ts, "rectangle")) - texture->addTexture(BImage_Rectangle); + texture->addTexture(BImage_Rectangle); else if (strstr(ts, "pyramid")) - texture->addTexture(BImage_Pyramid); + texture->addTexture(BImage_Pyramid); else if (strstr(ts, "pipecross")) - texture->addTexture(BImage_PipeCross); + texture->addTexture(BImage_PipeCross); else if (strstr(ts, "elliptic")) - texture->addTexture(BImage_Elliptic); + texture->addTexture(BImage_Elliptic); else if (strstr(ts, "diagonal")) - texture->addTexture(BImage_Diagonal); + texture->addTexture(BImage_Diagonal); else if (strstr(ts, "horizontal")) - texture->addTexture(BImage_Horizontal); + texture->addTexture(BImage_Horizontal); else if (strstr(ts, "vertical")) - texture->addTexture(BImage_Vertical); + texture->addTexture(BImage_Vertical); else - texture->addTexture(BImage_Diagonal); + texture->addTexture(BImage_Diagonal); } else texture->addTexture(BImage_Solid); @@ -2381,9 +2381,9 @@ void BImageControl::parseTexture(BTexture *texture, char *t) { if (! (texture->getTexture() & BImage_Flat)) if (strstr(ts, "bevel2")) - texture->addTexture(BImage_Bevel2); + texture->addTexture(BImage_Bevel2); else - texture->addTexture(BImage_Bevel1); + texture->addTexture(BImage_Bevel1); #ifdef INTERLACE if (strstr(ts, "interlaced")) diff --git a/src/Image.hh b/src/Image.hh index 05c4273d..4f3ff307 100644 --- a/src/Image.hh +++ b/src/Image.hh @@ -36,37 +36,37 @@ class BImageControl; // bevel options -#define BImage_Flat (1l<<1) -#define BImage_Sunken (1l<<2) -#define BImage_Raised (1l<<3) +#define BImage_Flat (1l<<1) +#define BImage_Sunken (1l<<2) +#define BImage_Raised (1l<<3) // textures -#define BImage_Solid (1l<<4) -#define BImage_Gradient (1l<<5) +#define BImage_Solid (1l<<4) +#define BImage_Gradient (1l<<5) // gradients -#define BImage_Horizontal (1l<<6) -#define BImage_Vertical (1l<<7) -#define BImage_Diagonal (1l<<8) -#define BImage_CrossDiagonal (1l<<9) -#define BImage_Rectangle (1l<<10) -#define BImage_Pyramid (1l<<11) -#define BImage_PipeCross (1l<<12) -#define BImage_Elliptic (1l<<13) +#define BImage_Horizontal (1l<<6) +#define BImage_Vertical (1l<<7) +#define BImage_Diagonal (1l<<8) +#define BImage_CrossDiagonal (1l<<9) +#define BImage_Rectangle (1l<<10) +#define BImage_Pyramid (1l<<11) +#define BImage_PipeCross (1l<<12) +#define BImage_Elliptic (1l<<13) // bevel types -#define BImage_Bevel1 (1l<<14) -#define BImage_Bevel2 (1l<<15) +#define BImage_Bevel1 (1l<<14) +#define BImage_Bevel2 (1l<<15) // inverted image -#define BImage_Invert (1l<<16) +#define BImage_Invert (1l<<16) // parent relative image #define BImage_ParentRelative (1l<<17) #ifdef INTERLACE // fake interlaced image -# define BImage_Interlaced (1l<<18) +# define BImage_Interlaced (1l<<18) #endif // INTERLACE class BColor { diff --git a/src/LinkedList.cc b/src/LinkedList.cc index 6df3f0ac..c9ea3f7a 100644 --- a/src/LinkedList.cc +++ b/src/LinkedList.cc @@ -1,235 +1,356 @@ -// // LinkedList.cc for Blackbox - an X11 Window manager -// Copyright (c) 1997, 1998 by Brad Hughes, bhughes@arn.net -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. +// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) // -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: // -// (See the included file COPYING / GPL-2.0) +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. // - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +// stupid macros needed to access some functions in version 2 of the GNU C +// library +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif // _GNU_SOURCE #include "LinkedList.hh" +#ifdef HAVE_CONFIG_H +# include "../config.h" +#endif // HAVE_CONFIG_H + +#ifdef HAVE_STDIO_H +# include +#endif // HAVE_STDIO_H -// ************************************************************************* -// Linked List iterator class code -// ************************************************************************* __llist_iterator::__llist_iterator(__llist *l) { + // initialize the iterator... list = l; + + if (list) { + if (! list->iterators) + list->iterators = new __llist; + + list->iterators->insert(this); + } + reset(); } __llist_iterator::~__llist_iterator(void) { + if (list && list->iterators) + list->iterators->remove(this); } void *__llist_iterator::current(void) { - return ((node) ? node->data : 0); + // return the current node data... if any + return ((node) ? node->getData() : 0); } void __llist_iterator::reset(void) { + // update the iterator's current node to the first node in the linked list if (list) node = list->_first; } -void __llist_iterator::resetLast(void) { - if (list) - node = list->_last; -} - const int __llist_iterator::set(const int index) { + // set the current node to index if (list) { - if (index < list->elements && index >= 0) { + if (index < list->elements && index >= 0 && list->_first) { node = list->_first; - int i; - for (i = 0; i < index; i++) - node = node->next; + for (register int i = 0; i < index; i++) + node = node->getNext(); return 1; } } - + node = (__llist_node *) 0; return 0; } -void __llist_iterator::operator++(int) { - node = ((node) ? node->next : 0); -} +void __llist_iterator::operator++(void) { + // iterate to the next node in the list... + node = ((node) ? node->getNext() : 0); +} -void __llist_iterator::operator--(int) { - node = ((node) ? node->prev : 0); +void __llist_iterator::operator++(int) { + // iterate to the next node in the list... + node = ((node) ? node->getNext() : 0); } -// ************************************************************************* -// Linked List class code -// ************************************************************************* - __llist::__llist(void *d) { - if (! d) { - _first = (__llist_node *) 0; - _last = (__llist_node *) 0; - elements = 0; - } else { - _first = new __llist_node; - _first->data = d; - _first->next = (__llist_node *) 0; - _first->prev = (__llist_node *) 0; - _last = _first; - elements = 1; - } + // initialize the linked list... + _first = (__llist_node *) 0; + _last = (__llist_node *) 0; + iterators = (__llist *) 0; + elements = 0; + + if (d) insert(d); } __llist::~__llist(void) { - int i, r = elements; - for (i = 0; i < r; i++) + // remove all the items in the list... + for (register int i = 0; i < elements; i++) remove(0); + + if (iterators) { + __llist_node *n = iterators->_first; + + while (n) { + __llist_iterator *p = (__llist_iterator *) n->getData(); + p->list = (__llist *) 0; + p->node = (__llist_node *) 0; + + n = n->getNext(); + } + + delete iterators; + } } const int __llist::insert(void *d, int index) { - if (! _first) { - _first = new __llist_node; - _first->data = d; - _first->next = (__llist_node *) 0; - _first->prev = (__llist_node *) 0; + // insert item into linked list at specified index... + + __llist_node *nnode = new __llist_node; + if (! nnode) return -1; + + if ((! _first) || (! _last)) { + // list is empty... insert the item as the first item, regardless of the + // index given + _first = nnode; + _first->setData(d); + _first->setNext((__llist_node *) 0); _last = _first; } else { - // if index is -1... append the data to the end of the list - if (index == -1) { - __llist_node *nnode = new __llist_node; - nnode->data = d; - nnode->next = (__llist_node *) 0; - - nnode->prev = _last; - _last->next = nnode; + if (index == 0) { + // if index is 0... prepend the data on the list + + nnode->setData(d); + nnode->setNext(_first); + + _first = nnode; + } else if ((index == -1) || (index == elements)) { + // if index is -1... append the data on the list + + nnode->setData(d); + nnode->setNext((__llist_node *) 0); + _last->setNext(nnode); + _last = nnode; - } else { + } else if (index < elements) { // otherwise... insert the item at the position specified by index - if (index > elements) return -1; - + __llist_node *inode = _first; + + for (register int i = 1; i < index; i++) { + if (inode) { + inode = inode->getNext(); + } else { + delete nnode; + return -1; + } + } + + nnode->setData(d); + + if ((! inode) || inode == _last) { + nnode->setNext((__llist_node *) 0); + _last->setNext(nnode); + + _last = nnode; + } else { + nnode->setNext(inode->getNext()); + inode->setNext(nnode); + } } } - + return ++elements; } - + const int __llist::remove(void *d) { // remove list item whose data pointer address matches the pointer address // given - __llist_node *rnode = _first; - - int i; - for (i = 0; i < elements; i++) { - if (rnode->data == d) { - if (rnode->prev) { - rnode->prev->next = rnode->next; - if (rnode->next) - rnode->next->prev = rnode->prev; - } else { - // we removed the _first item in the list... reflect that removal in the - // list internals - _first = rnode->next; - if (_first) - _first->prev = (__llist_node *) 0; + if ((! _first) || (! _last)) + return -1; + + if (_first->getData() == d) { + // remove the first item in the list... + __llist_node *node = _first; + _first = _first->getNext(); + + if (iterators && iterators->_first) { + __llist_node *n = iterators->_first; + while (n) { + ((__llist_iterator *) n->getData())->reset(); + n = n->getNext(); } - - if (rnode == _last) { - _last = rnode->prev; - if (_last) - _last->next = (__llist_node *) 0; + } + + --elements; + delete node; + return 0; + } else { + // iterate through the list and remove the first occurance of the item + + // NOTE: we don't validate _first in this assignment, because it is checked + // for validity above... + __llist_node *rnode = _first->getNext(), *prev = _first; + + for (register int i = 1; i < elements; i++) { + if (rnode) { + if (rnode->getData() == d) { + // we found the item... update the previous node and delete the + // now useless rnode... + prev->setNext(rnode->getNext()); + + if (rnode == _last) + _last = prev; + + if (iterators && iterators->_first) { + __llist_node *n = iterators->_first; + while (n) { + ((__llist_iterator *) n->getData())->reset(); + n = n->getNext(); + } + } + + --elements; + delete rnode; + return i; + } else { + prev = rnode; + rnode = rnode->getNext(); + } } - - --elements; - delete rnode; - break; } - - if (rnode) - rnode = rnode->next; - else - return -1; + + return -1; } - - return i; } void *__llist::remove(const int index) { - if (index < elements && index >= 0) { - // remove list item at specified index within the list - - __llist_node *rnode = _first; - void *data_return = 0; + if (index >= elements || index < 0 || (! _first) || (! _last)) + return (void *) 0; + + // remove list item at specified index within the list + if (index == 0) { + // remove the first item in the list... + __llist_node *node = _first; + void *data_return = _first->getData(); - int i; - for (i = 0; i < index; i++) - rnode = rnode->next; - - if (rnode->prev) { - rnode->prev->next = rnode->next; - if (rnode->next) - rnode->next->prev = rnode->prev; - } else { - // we removed the _first item in the list... reflect that removal in the - // list internals - _first = rnode->next; - if (_first) - _first->prev = (__llist_node *) 0; + _first = _first->getNext(); + + if (iterators && iterators->_first) { + __llist_node *n = iterators->_first; + while (n) { + ((__llist_iterator *) n->getData())->reset(); + n = n->getNext(); + } } - if (rnode == _last) { - _last = rnode->prev; - if (_last) - _last->next = (__llist_node *) 0; + --elements; + delete node; + + return data_return; + } else { + __llist_node *rnode = _first->getNext(), *prev = _first; + void *data_return = (void *) 0; + + for (register int i = 1; i < index; i++) { + if (rnode) { + prev = rnode; + rnode = rnode->getNext(); + } else { + return (void *) 0; + } } + if (! rnode) return (void *) 0; + + prev->setNext(rnode->getNext()); + data_return = rnode->getData(); + + if (rnode == _last) + _last = prev; + + if (iterators && iterators->_first) { + __llist_node *n = iterators->_first; + while (n) { + ((__llist_iterator *) n->getData())->reset(); + n = n->getNext(); + } + } + --elements; - data_return = rnode->data; + data_return = rnode->getData(); delete rnode; return data_return; } - + return (void *) 0; } void *__llist::find(const int index) { - if (index < elements && index >= 0) { - __llist_node *fnode = _first; + if (index >= elements || index < 0 || (! _first) || (! _last)) + return (void *) 0; - int i; - for (i = 0; i < index; i++) - fnode = fnode->next; + if (index == 0) // return the first item + return first(); + if (index == (elements - 1)) // return the last item + return last(); - return fnode->data; + __llist_node *fnode = _first->getNext(); + + for (register int i = 1; i < index; i++) { + if (fnode) + fnode = fnode->getNext(); + else + return (void *) 0; } + + return fnode->getData(); +} + + +void *__llist::first(void) { + if (_first) + return _first->getData(); + + return (void *) 0; +} + + +void *__llist::last(void) { + if (_last) + return _last->getData(); return (void *) 0; } diff --git a/src/Rootmenu.cc b/src/Rootmenu.cc index 9054e8cc..e3497bf3 100644 --- a/src/Rootmenu.cc +++ b/src/Rootmenu.cc @@ -68,9 +68,9 @@ void Rootmenu::itemSelected(int button, int index) { #ifndef __EMX__ char displaystring[MAXPATHLEN]; sprintf(displaystring, "DISPLAY=%s", - DisplayString(screen->getBaseDisplay()->getXDisplay())); + DisplayString(screen->getBaseDisplay()->getXDisplay())); sprintf(displaystring + strlen(displaystring) - 1, "%d", - screen->getScreenNumber()); + screen->getScreenNumber()); bexec(item->exec(), displaystring); #else // __EMX__ diff --git a/src/Screen.cc b/src/Screen.cc index 57d15a8d..cd815d86 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -167,14 +167,14 @@ static const char *getFontSize(const char *pattern, int *size) { for (p=pattern; 1; p++) { if (!*p) { if (p2!=NULL && n>1 && n<72) { - *size = n; return p2+1; + *size = n; return p2+1; } else { - *size = 16; return NULL; + *size = 16; return NULL; } } else if (*p=='-') { if (n>1 && n<72 && p2!=NULL) { - *size = n; - return p2+1; + *size = n; + return p2+1; } p2=p; n=0; } else if (*p>='0' && *p<='9' && p2!=NULL) { @@ -205,7 +205,7 @@ BScreen::BScreen(Blackbox *bb, int scrn) : ScreenInfo(bb, scrn) { fprintf(stderr, i18n(ScreenSet, ScreenManagingScreen, "BScreen::BScreen: managing screen %d " "using visual 0x%lx, depth %d\n"), - getScreenNumber(), XVisualIDFromVisual(getVisual()), + getScreenNumber(), XVisualIDFromVisual(getVisual()), getDepth()); rootmenu = 0; @@ -261,7 +261,7 @@ BScreen::BScreen(Blackbox *bb, int scrn) : ScreenInfo(bb, scrn) { if (! i18n.multibyte()) gc_value_mask |= GCFont; gcv.foreground = WhitePixel(getBaseDisplay()->getXDisplay(), - getScreenNumber()) + getScreenNumber()) ^ BlackPixel(getBaseDisplay()->getXDisplay(), getScreenNumber()); gcv.function = GXxor; @@ -274,75 +274,75 @@ BScreen::BScreen(Blackbox *bb, int scrn) : ScreenInfo(bb, scrn) { gcv.font = resource.wstyle.font->fid; resource.wstyle.l_text_focus_gc = XCreateGC(getBaseDisplay()->getXDisplay(), getRootWindow(), - gc_value_mask, &gcv); + gc_value_mask, &gcv); gcv.foreground = resource.wstyle.l_text_unfocus.getPixel(); if (resource.wstyle.font) gcv.font = resource.wstyle.font->fid; resource.wstyle.l_text_unfocus_gc = XCreateGC(getBaseDisplay()->getXDisplay(), getRootWindow(), - gc_value_mask, &gcv); + gc_value_mask, &gcv); gcv.foreground = resource.wstyle.b_pic_focus.getPixel(); resource.wstyle.b_pic_focus_gc = XCreateGC(getBaseDisplay()->getXDisplay(), getRootWindow(), - GCForeground, &gcv); + GCForeground, &gcv); gcv.foreground = resource.wstyle.b_pic_unfocus.getPixel(); resource.wstyle.b_pic_unfocus_gc = XCreateGC(getBaseDisplay()->getXDisplay(), getRootWindow(), - GCForeground, &gcv); + GCForeground, &gcv); gcv.foreground = resource.mstyle.t_text.getPixel(); if (resource.mstyle.t_font) gcv.font = resource.mstyle.t_font->fid; resource.mstyle.t_text_gc = XCreateGC(getBaseDisplay()->getXDisplay(), getRootWindow(), - gc_value_mask, &gcv); + gc_value_mask, &gcv); gcv.foreground = resource.mstyle.f_text.getPixel(); if (resource.mstyle.f_font) gcv.font = resource.mstyle.f_font->fid; resource.mstyle.f_text_gc = XCreateGC(getBaseDisplay()->getXDisplay(), getRootWindow(), - gc_value_mask, &gcv); + gc_value_mask, &gcv); gcv.foreground = resource.mstyle.h_text.getPixel(); resource.mstyle.h_text_gc = XCreateGC(getBaseDisplay()->getXDisplay(), getRootWindow(), - gc_value_mask, &gcv); + gc_value_mask, &gcv); gcv.foreground = resource.mstyle.d_text.getPixel(); resource.mstyle.d_text_gc = XCreateGC(getBaseDisplay()->getXDisplay(), getRootWindow(), - gc_value_mask, &gcv); + gc_value_mask, &gcv); gcv.foreground = resource.mstyle.hilite.getColor()->getPixel(); resource.mstyle.hilite_gc = XCreateGC(getBaseDisplay()->getXDisplay(), getRootWindow(), - gc_value_mask, &gcv); + gc_value_mask, &gcv); gcv.foreground = resource.tstyle.l_text.getPixel(); if (resource.tstyle.font) gcv.font = resource.tstyle.font->fid; resource.tstyle.l_text_gc = XCreateGC(getBaseDisplay()->getXDisplay(), getRootWindow(), - gc_value_mask, &gcv); + gc_value_mask, &gcv); gcv.foreground = resource.tstyle.w_text.getPixel(); resource.tstyle.w_text_gc = XCreateGC(getBaseDisplay()->getXDisplay(), getRootWindow(), - gc_value_mask, &gcv); + gc_value_mask, &gcv); gcv.foreground = resource.tstyle.c_text.getPixel(); resource.tstyle.c_text_gc = XCreateGC(getBaseDisplay()->getXDisplay(), getRootWindow(), - gc_value_mask, &gcv); + gc_value_mask, &gcv); gcv.foreground = resource.tstyle.b_pic.getPixel(); resource.tstyle.b_pic_gc = XCreateGC(getBaseDisplay()->getXDisplay(), getRootWindow(), - gc_value_mask, &gcv); + gc_value_mask, &gcv); const char *s = i18n(ScreenSet, ScreenPositionLength, "0: 0000 x 0: 0000"); @@ -381,24 +381,24 @@ BScreen::BScreen(Blackbox *bb, int scrn) : ScreenInfo(bb, scrn) { (BImage_Flat | BImage_Solid)) { geom_pixmap = None; XSetWindowBackground(getBaseDisplay()->getXDisplay(), geom_window, - resource.wstyle.t_focus.getColor()->getPixel()); + resource.wstyle.t_focus.getColor()->getPixel()); } else { geom_pixmap = image_control->renderImage(geom_w, geom_h, - &resource.wstyle.t_focus); + &resource.wstyle.t_focus); XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(), - geom_window, geom_pixmap); + geom_window, geom_pixmap); } } else { if (resource.wstyle.l_focus.getTexture() == (BImage_Flat | BImage_Solid)) { geom_pixmap = None; XSetWindowBackground(getBaseDisplay()->getXDisplay(), geom_window, - resource.wstyle.l_focus.getColor()->getPixel()); + resource.wstyle.l_focus.getColor()->getPixel()); } else { geom_pixmap = image_control->renderImage(geom_w, geom_h, - &resource.wstyle.l_focus); + &resource.wstyle.l_focus); XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(), - geom_window, geom_pixmap); + geom_window, geom_pixmap); } } @@ -420,7 +420,7 @@ BScreen::BScreen(Blackbox *bb, int scrn) : ScreenInfo(bb, scrn) { } workspacemenu->insert(i18n(IconSet, IconIcons, "Icons"), - iconmenu); + iconmenu); workspacemenu->update(); current_workspace = workspacesList->first(); @@ -445,18 +445,18 @@ BScreen::BScreen(Blackbox *bb, int scrn) : ScreenInfo(bb, scrn) { unsigned int nchild; Window r, p, *children; XQueryTree(getBaseDisplay()->getXDisplay(), getRootWindow(), &r, &p, - &children, &nchild); + &children, &nchild); // preen the window list of all icon windows... for better dockapp support for (i = 0; i < (int) nchild; i++) { if (children[i] == None) continue; XWMHints *wmhints = XGetWMHints(getBaseDisplay()->getXDisplay(), - children[i]); + children[i]); if (wmhints) { if ((wmhints->flags & IconWindowHint) && - (wmhints->icon_window != children[i])) + (wmhints->icon_window != children[i])) for (int j = 0; j < (int) nchild; j++) if (children[j] == wmhints->icon_window) { children[j] = None; @@ -486,7 +486,7 @@ BScreen::BScreen(Blackbox *bb, int scrn) : ScreenInfo(bb, scrn) { XMapRequestEvent mre; mre.window = children[i]; win->restoreAttributes(); - win->mapRequestEvent(&mre); + win->mapRequestEvent(&mre); } } } @@ -499,7 +499,7 @@ BScreen::BScreen(Blackbox *bb, int scrn) : ScreenInfo(bb, scrn) { if (! resource.sloppy_focus) XSetInputFocus(getBaseDisplay()->getXDisplay(), toolbar->getWindowID(), - RevertToParent, CurrentTime); + RevertToParent, CurrentTime); XFlush(getBaseDisplay()->getXDisplay()); } @@ -573,43 +573,43 @@ BScreen::~BScreen(void) { XFreeGC(getBaseDisplay()->getXDisplay(), opGC); XFreeGC(getBaseDisplay()->getXDisplay(), - resource.wstyle.l_text_focus_gc); + resource.wstyle.l_text_focus_gc); XFreeGC(getBaseDisplay()->getXDisplay(), - resource.wstyle.l_text_unfocus_gc); + resource.wstyle.l_text_unfocus_gc); XFreeGC(getBaseDisplay()->getXDisplay(), - resource.wstyle.b_pic_focus_gc); + resource.wstyle.b_pic_focus_gc); XFreeGC(getBaseDisplay()->getXDisplay(), - resource.wstyle.b_pic_unfocus_gc); + resource.wstyle.b_pic_unfocus_gc); XFreeGC(getBaseDisplay()->getXDisplay(), - resource.mstyle.t_text_gc); + resource.mstyle.t_text_gc); XFreeGC(getBaseDisplay()->getXDisplay(), - resource.mstyle.f_text_gc); + resource.mstyle.f_text_gc); XFreeGC(getBaseDisplay()->getXDisplay(), - resource.mstyle.h_text_gc); + resource.mstyle.h_text_gc); XFreeGC(getBaseDisplay()->getXDisplay(), - resource.mstyle.d_text_gc); + resource.mstyle.d_text_gc); XFreeGC(getBaseDisplay()->getXDisplay(), - resource.mstyle.hilite_gc); + resource.mstyle.hilite_gc); XFreeGC(getBaseDisplay()->getXDisplay(), - resource.tstyle.l_text_gc); + resource.tstyle.l_text_gc); XFreeGC(getBaseDisplay()->getXDisplay(), - resource.tstyle.w_text_gc); + resource.tstyle.w_text_gc); XFreeGC(getBaseDisplay()->getXDisplay(), - resource.tstyle.c_text_gc); + resource.tstyle.c_text_gc); XFreeGC(getBaseDisplay()->getXDisplay(), - resource.tstyle.b_pic_gc); + resource.tstyle.b_pic_gc); } void BScreen::readDatabaseTexture(char *rname, char *rclass, - BTexture *texture, - unsigned long default_pixel) { + BTexture *texture, + unsigned long default_pixel) { XrmValue value; char *value_type; if (XrmGetResource(resource.stylerc, rname, rclass, &value_type, - &value)) + &value)) image_control->parseTexture(texture, value.addr); else texture->setTexture(BImage_Solid | BImage_Flat); @@ -623,7 +623,7 @@ void BScreen::readDatabaseTexture(char *rname, char *rclass, sprintf(colorname, "%s.color", rname); readDatabaseColor(colorname, colorclass, texture->getColor(), - default_pixel); + default_pixel); #ifdef INTERLACE sprintf(colorclass, "%s.ColorTo", rclass); @@ -637,42 +637,42 @@ void BScreen::readDatabaseTexture(char *rname, char *rclass, delete [] colorname; if ((! texture->getColor()->isAllocated()) || - (texture->getTexture() & BImage_Flat)) + (texture->getTexture() & BImage_Flat)) return; XColor xcol; xcol.red = (unsigned int) (texture->getColor()->getRed() + - (texture->getColor()->getRed() >> 1)); + (texture->getColor()->getRed() >> 1)); if (xcol.red >= 0xff) xcol.red = 0xffff; else xcol.red *= 0xff; xcol.green = (unsigned int) (texture->getColor()->getGreen() + - (texture->getColor()->getGreen() >> 1)); + (texture->getColor()->getGreen() >> 1)); if (xcol.green >= 0xff) xcol.green = 0xffff; else xcol.green *= 0xff; xcol.blue = (unsigned int) (texture->getColor()->getBlue() + - (texture->getColor()->getBlue() >> 1)); + (texture->getColor()->getBlue() >> 1)); if (xcol.blue >= 0xff) xcol.blue = 0xffff; else xcol.blue *= 0xff; if (! XAllocColor(getBaseDisplay()->getXDisplay(), - getColormap(), &xcol)) + getColormap(), &xcol)) xcol.pixel = 0; texture->getHiColor()->setPixel(xcol.pixel); xcol.red = (unsigned int) ((texture->getColor()->getRed() >> 2) + - (texture->getColor()->getRed() >> 1)) * 0xff; + (texture->getColor()->getRed() >> 1)) * 0xff; xcol.green = (unsigned int) ((texture->getColor()->getGreen() >> 2) + - (texture->getColor()->getGreen() >> 1)) * 0xff; + (texture->getColor()->getGreen() >> 1)) * 0xff; xcol.blue = (unsigned int) ((texture->getColor()->getBlue() >> 2) + - (texture->getColor()->getBlue() >> 1)) * 0xff; + (texture->getColor()->getBlue() >> 1)) * 0xff; if (! XAllocColor(getBaseDisplay()->getXDisplay(), - getColormap(), &xcol)) + getColormap(), &xcol)) xcol.pixel = 0; texture->getLoColor()->setPixel(xcol.pixel); @@ -689,9 +689,9 @@ void BScreen::readDatabaseTexture(char *rname, char *rclass, sprintf(colortoname, "%s.colorTo", rname); readDatabaseColor(colorname, colorclass, texture->getColor(), - default_pixel); + default_pixel); readDatabaseColor(colortoname, colortoclass, texture->getColorTo(), - default_pixel); + default_pixel); delete [] colorclass; delete [] colorname; @@ -702,12 +702,12 @@ void BScreen::readDatabaseTexture(char *rname, char *rclass, void BScreen::readDatabaseColor(char *rname, char *rclass, BColor *color, - unsigned long default_pixel) { + unsigned long default_pixel) { XrmValue value; char *value_type; if (XrmGetResource(resource.stylerc, rname, rclass, &value_type, - &value)) { + &value)) { image_control->parseColor(color, value.addr); } else { // parsing with no color string just deallocates the color, if it has @@ -719,7 +719,7 @@ void BScreen::readDatabaseColor(char *rname, char *rclass, BColor *color, void BScreen::readDatabaseFontSet(char *rname, char *rclass, - XFontSet *fontset) { + XFontSet *fontset) { if (! fontset) return; static char *defaultFont = "fixed"; @@ -765,10 +765,10 @@ void BScreen::readDatabaseFont(char *rname, char *rclass, XFontStruct **font){ if (XrmGetResource(resource.stylerc, rname, rclass, &value_type, &value)) { if ((*font = XLoadQueryFont(getBaseDisplay()->getXDisplay(), - value.addr)) == NULL) { + value.addr)) == NULL) { fprintf(stderr, i18n(ScreenSet, ScreenFontLoadFail, "BScreen::LoadStyle(): couldn't load font '%s'\n"), - value.addr); + value.addr); load_default = True; } @@ -778,7 +778,7 @@ void BScreen::readDatabaseFont(char *rname, char *rclass, XFontStruct **font){ if (load_default) { if ((*font = XLoadQueryFont(getBaseDisplay()->getXDisplay(), - defaultFont)) == NULL) { + defaultFont)) == NULL) { fprintf(stderr, i18n(ScreenSet, ScreenDefaultFontLoadFail, "BScreen::LoadStyle(): couldn't load default font.\n")); exit(2); @@ -794,7 +794,7 @@ XFontSet BScreen::createFontSet(char *fontname) { char weight[FONT_ELEMENT_SIZE], slant[FONT_ELEMENT_SIZE]; fs = XCreateFontSet(getBaseDisplay()->getXDisplay(), - fontname, &missing, &nmissing, &def); + fontname, &missing, &nmissing, &def); if (fs && (! nmissing)) return fs; #ifdef HAVE_SETLOCALE @@ -803,7 +803,7 @@ XFontSet BScreen::createFontSet(char *fontname) { setlocale(LC_CTYPE, "C"); fs = XCreateFontSet(getBaseDisplay()->getXDisplay(), fontname, - &missing, &nmissing, &def); + &missing, &nmissing, &def); setlocale(LC_CTYPE, ""); } #endif // HAVE_SETLOCALE @@ -816,9 +816,9 @@ XFontSet BScreen::createFontSet(char *fontname) { } getFontElement(fontname, weight, FONT_ELEMENT_SIZE, - "-medium-", "-bold-", "-demibold-", "-regular-", NULL); + "-medium-", "-bold-", "-demibold-", "-regular-", NULL); getFontElement(fontname, slant, FONT_ELEMENT_SIZE, - "-r-", "-i-", "-o-", "-ri-", "-ro-", NULL); + "-r-", "-i-", "-o-", "-ri-", "-ro-", NULL); getFontSize(fontname, &pixel_size); if (! strcmp(weight, "*")) strncpy(weight, "medium", FONT_ELEMENT_SIZE); @@ -829,17 +829,17 @@ XFontSet BScreen::createFontSet(char *fontname) { buf_size = strlen(fontname) + (FONT_ELEMENT_SIZE * 2) + 64; char *pattern2 = new char[buf_size]; snprintf(pattern2, buf_size - 1, - "%s," - "-*-*-%s-%s-*-*-%d-*-*-*-*-*-*-*," - "-*-*-*-*-*-*-%d-*-*-*-*-*-*-*,*", - fontname, weight, slant, pixel_size, pixel_size); + "%s," + "-*-*-%s-%s-*-*-%d-*-*-*-*-*-*-*," + "-*-*-*-*-*-*-%d-*-*-*-*-*-*-*,*", + fontname, weight, slant, pixel_size, pixel_size); fontname = pattern2; if (nmissing) XFreeStringList(missing); if (fs) XFreeFontSet(getBaseDisplay()->getXDisplay(), fs); fs = XCreateFontSet(getBaseDisplay()->getXDisplay(), fontname, - &missing, &nmissing, &def); + &missing, &nmissing, &def); delete [] pattern2; return fs; @@ -854,72 +854,72 @@ void BScreen::reconfigure(void) { if (! i18n.multibyte()) gc_value_mask |= GCFont; gcv.foreground = WhitePixel(getBaseDisplay()->getXDisplay(), - getScreenNumber()); + getScreenNumber()); gcv.function = GXinvert; gcv.subwindow_mode = IncludeInferiors; XChangeGC(getBaseDisplay()->getXDisplay(), opGC, - GCForeground | GCFunction | GCSubwindowMode, &gcv); + GCForeground | GCFunction | GCSubwindowMode, &gcv); gcv.foreground = resource.wstyle.l_text_focus.getPixel(); if (resource.wstyle.font) gcv.font = resource.wstyle.font->fid; XChangeGC(getBaseDisplay()->getXDisplay(), resource.wstyle.l_text_focus_gc, - gc_value_mask, &gcv); + gc_value_mask, &gcv); gcv.foreground = resource.wstyle.l_text_unfocus.getPixel(); XChangeGC(getBaseDisplay()->getXDisplay(), resource.wstyle.l_text_unfocus_gc, - gc_value_mask, &gcv); + gc_value_mask, &gcv); gcv.foreground = resource.wstyle.b_pic_focus.getPixel(); XChangeGC(getBaseDisplay()->getXDisplay(), resource.wstyle.b_pic_focus_gc, - GCForeground, &gcv); + GCForeground, &gcv); gcv.foreground = resource.wstyle.b_pic_unfocus.getPixel(); XChangeGC(getBaseDisplay()->getXDisplay(), resource.wstyle.b_pic_unfocus_gc, - GCForeground, &gcv); + GCForeground, &gcv); gcv.foreground = resource.mstyle.t_text.getPixel(); if (resource.mstyle.t_font) gcv.font = resource.mstyle.t_font->fid; XChangeGC(getBaseDisplay()->getXDisplay(), resource.mstyle.t_text_gc, - gc_value_mask, &gcv); + gc_value_mask, &gcv); gcv.foreground = resource.mstyle.f_text.getPixel(); if (resource.mstyle.f_font) gcv.font = resource.mstyle.f_font->fid; XChangeGC(getBaseDisplay()->getXDisplay(), resource.mstyle.f_text_gc, - gc_value_mask, &gcv); + gc_value_mask, &gcv); gcv.foreground = resource.mstyle.h_text.getPixel(); XChangeGC(getBaseDisplay()->getXDisplay(), resource.mstyle.h_text_gc, - gc_value_mask, &gcv); + gc_value_mask, &gcv); gcv.foreground = resource.mstyle.d_text.getPixel(); XChangeGC(getBaseDisplay()->getXDisplay(), resource.mstyle.d_text_gc, - gc_value_mask, &gcv); + gc_value_mask, &gcv); gcv.foreground = resource.mstyle.hilite.getColor()->getPixel(); XChangeGC(getBaseDisplay()->getXDisplay(), resource.mstyle.hilite_gc, - gc_value_mask, &gcv); + gc_value_mask, &gcv); gcv.foreground = resource.tstyle.l_text.getPixel(); if (resource.tstyle.font) gcv.font = resource.tstyle.font->fid; XChangeGC(getBaseDisplay()->getXDisplay(), resource.tstyle.l_text_gc, - gc_value_mask, &gcv); + gc_value_mask, &gcv); gcv.foreground = resource.tstyle.w_text.getPixel(); XChangeGC(getBaseDisplay()->getXDisplay(), resource.tstyle.w_text_gc, - gc_value_mask, &gcv); + gc_value_mask, &gcv); gcv.foreground = resource.tstyle.c_text.getPixel(); XChangeGC(getBaseDisplay()->getXDisplay(), resource.tstyle.c_text_gc, - gc_value_mask, &gcv); + gc_value_mask, &gcv); gcv.foreground = resource.tstyle.b_pic.getPixel(); XChangeGC(getBaseDisplay()->getXDisplay(), resource.tstyle.b_pic_gc, - gc_value_mask, &gcv); + gc_value_mask, &gcv); const char *s = i18n(ScreenSet, ScreenPositionLength, "0: 0000 x 0: 0000"); @@ -950,9 +950,9 @@ void BScreen::reconfigure(void) { resource.wstyle.t_focus.getColor()->getPixel()); } else { geom_pixmap = image_control->renderImage(geom_w, geom_h, - &resource.wstyle.t_focus); + &resource.wstyle.t_focus); XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(), - geom_window, geom_pixmap); + geom_window, geom_pixmap); } } else { if (resource.wstyle.l_focus.getTexture() == @@ -962,9 +962,9 @@ void BScreen::reconfigure(void) { resource.wstyle.l_focus.getColor()->getPixel()); } else { geom_pixmap = image_control->renderImage(geom_w, geom_h, - &resource.wstyle.l_focus); + &resource.wstyle.l_focus); XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(), - geom_window, geom_pixmap); + geom_window, geom_pixmap); } } if (tmp) image_control->removeImage(tmp); @@ -1030,13 +1030,13 @@ void BScreen::LoadStyle(void) { if (i18n.multibyte()) { readDatabaseFontSet("window.font", "Window.Font", - &resource.wstyle.fontset); + &resource.wstyle.fontset); readDatabaseFontSet("toolbar.font", "Toolbar.Font", - &resource.tstyle.fontset); + &resource.tstyle.fontset); readDatabaseFontSet("menu.title.font", "Menu.Title.Font", - &resource.mstyle.t_fontset); + &resource.mstyle.t_fontset); readDatabaseFontSet("menu.frame.font", "Menu.Frame.Font", - &resource.mstyle.f_fontset); + &resource.mstyle.f_fontset); resource.mstyle.t_fontset_extents = XExtentsOfFontSet(resource.mstyle.t_fontset); @@ -1048,93 +1048,93 @@ void BScreen::LoadStyle(void) { XExtentsOfFontSet(resource.wstyle.fontset); } else { readDatabaseFont("window.font", "Window.Font", - &resource.wstyle.font); + &resource.wstyle.font); readDatabaseFont("menu.title.font", "Menu.Title.Font", - &resource.mstyle.t_font); + &resource.mstyle.t_font); readDatabaseFont("menu.frame.font", "Menu.Frame.Font", - &resource.mstyle.f_font); + &resource.mstyle.f_font); readDatabaseFont("toolbar.font", "Toolbar.Font", - &resource.tstyle.font); + &resource.tstyle.font); } // load window config readDatabaseTexture("window.title.focus", "Window.Title.Focus", - &resource.wstyle.t_focus, - WhitePixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + &resource.wstyle.t_focus, + WhitePixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseTexture("window.title.unfocus", "Window.Title.Unfocus", - &resource.wstyle.t_unfocus, - BlackPixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + &resource.wstyle.t_unfocus, + BlackPixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseTexture("window.label.focus", "Window.Label.Focus", - &resource.wstyle.l_focus, - WhitePixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + &resource.wstyle.l_focus, + WhitePixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseTexture("window.label.unfocus", "Window.Label.Unfocus", - &resource.wstyle.l_unfocus, - BlackPixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + &resource.wstyle.l_unfocus, + BlackPixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseTexture("window.handle.focus", "Window.Handle.Focus", - &resource.wstyle.h_focus, - WhitePixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + &resource.wstyle.h_focus, + WhitePixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseTexture("window.handle.unfocus", "Window.Handle.Unfocus", - &resource.wstyle.h_unfocus, - BlackPixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + &resource.wstyle.h_unfocus, + BlackPixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseTexture("window.grip.focus", "Window.Grip.Focus", &resource.wstyle.g_focus, - WhitePixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + WhitePixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseTexture("window.grip.unfocus", "Window.Grip.Unfocus", &resource.wstyle.g_unfocus, - BlackPixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + BlackPixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseTexture("window.button.focus", "Window.Button.Focus", - &resource.wstyle.b_focus, - WhitePixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + &resource.wstyle.b_focus, + WhitePixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseTexture("window.button.unfocus", "Window.Button.Unfocus", - &resource.wstyle.b_unfocus, - BlackPixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + &resource.wstyle.b_unfocus, + BlackPixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseTexture("window.button.pressed", "Window.Button.Pressed", - &resource.wstyle.b_pressed, - BlackPixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + &resource.wstyle.b_pressed, + BlackPixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseColor("window.frame.focusColor", - "Window.Frame.FocusColor", - &resource.wstyle.f_focus, - WhitePixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + "Window.Frame.FocusColor", + &resource.wstyle.f_focus, + WhitePixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseColor("window.frame.unfocusColor", - "Window.Frame.UnfocusColor", - &resource.wstyle.f_unfocus, - BlackPixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + "Window.Frame.UnfocusColor", + &resource.wstyle.f_unfocus, + BlackPixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseColor("window.label.focus.textColor", - "Window.Label.Focus.TextColor", - &resource.wstyle.l_text_focus, - BlackPixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + "Window.Label.Focus.TextColor", + &resource.wstyle.l_text_focus, + BlackPixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseColor("window.label.unfocus.textColor", - "Window.Label.Unfocus.TextColor", - &resource.wstyle.l_text_unfocus, - WhitePixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + "Window.Label.Unfocus.TextColor", + &resource.wstyle.l_text_unfocus, + WhitePixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseColor("window.button.focus.picColor", - "Window.Button.Focus.PicColor", - &resource.wstyle.b_pic_focus, - BlackPixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + "Window.Button.Focus.PicColor", + &resource.wstyle.b_pic_focus, + BlackPixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseColor("window.button.unfocus.picColor", - "Window.Button.Unfocus.PicColor", - &resource.wstyle.b_pic_unfocus, - WhitePixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + "Window.Button.Unfocus.PicColor", + &resource.wstyle.b_pic_unfocus, + WhitePixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); if (XrmGetResource(resource.stylerc, "window.justify", "Window.Justify", - &value_type, &value)) { + &value_type, &value)) { if (strstr(value.addr, "right") || strstr(value.addr, "Right")) resource.wstyle.justify = BScreen::RightJustify; else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) @@ -1146,49 +1146,49 @@ void BScreen::LoadStyle(void) { } // load toolbar config readDatabaseTexture("toolbar", "Toolbar", - &resource.tstyle.toolbar, - BlackPixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + &resource.tstyle.toolbar, + BlackPixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseTexture("toolbar.label", "Toolbar.Label", - &resource.tstyle.label, - BlackPixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + &resource.tstyle.label, + BlackPixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseTexture("toolbar.windowLabel", "Toolbar.WindowLabel", - &resource.tstyle.window, - BlackPixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + &resource.tstyle.window, + BlackPixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseTexture("toolbar.button", "Toolbar.Button", - &resource.tstyle.button, - WhitePixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + &resource.tstyle.button, + WhitePixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseTexture("toolbar.button.pressed", "Toolbar.Button.Pressed", - &resource.tstyle.pressed, - BlackPixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + &resource.tstyle.pressed, + BlackPixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseTexture("toolbar.clock", "Toolbar.Clock", - &resource.tstyle.clock, - BlackPixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + &resource.tstyle.clock, + BlackPixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseColor("toolbar.label.textColor", "Toolbar.Label.TextColor", - &resource.tstyle.l_text, - WhitePixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + &resource.tstyle.l_text, + WhitePixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseColor("toolbar.windowLabel.textColor", - "Toolbar.WindowLabel.TextColor", - &resource.tstyle.w_text, - WhitePixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + "Toolbar.WindowLabel.TextColor", + &resource.tstyle.w_text, + WhitePixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseColor("toolbar.clock.textColor", "Toolbar.Clock.TextColor", - &resource.tstyle.c_text, - WhitePixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + &resource.tstyle.c_text, + WhitePixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseColor("toolbar.button.picColor", "Toolbar.Button.PicColor", - &resource.tstyle.b_pic, - BlackPixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + &resource.tstyle.b_pic, + BlackPixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); if (XrmGetResource(resource.stylerc, "toolbar.justify", - "Toolbar.Justify", &value_type, &value)) { + "Toolbar.Justify", &value_type, &value)) { if (strstr(value.addr, "right") || strstr(value.addr, "Right")) resource.tstyle.justify = BScreen::RightJustify; else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) @@ -1200,37 +1200,37 @@ void BScreen::LoadStyle(void) { } // load menu config readDatabaseTexture("menu.title", "Menu.Title", - &resource.mstyle.title, - WhitePixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + &resource.mstyle.title, + WhitePixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseTexture("menu.frame", "Menu.Frame", - &resource.mstyle.frame, - BlackPixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + &resource.mstyle.frame, + BlackPixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseTexture("menu.hilite", "Menu.Hilite", - &resource.mstyle.hilite, - WhitePixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + &resource.mstyle.hilite, + WhitePixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseColor("menu.title.textColor", "Menu.Title.TextColor", - &resource.mstyle.t_text, - BlackPixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + &resource.mstyle.t_text, + BlackPixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseColor("menu.frame.textColor", "Menu.Frame.TextColor", - &resource.mstyle.f_text, - WhitePixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + &resource.mstyle.f_text, + WhitePixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseColor("menu.frame.disableColor", "Menu.Frame.DisableColor", - &resource.mstyle.d_text, - BlackPixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + &resource.mstyle.d_text, + BlackPixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); readDatabaseColor("menu.hilite.textColor", "Menu.Hilite.TextColor", - &resource.mstyle.h_text, - BlackPixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + &resource.mstyle.h_text, + BlackPixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); if (XrmGetResource(resource.stylerc, "menu.title.justify", - "Menu.Title.Justify", - &value_type, &value)) { + "Menu.Title.Justify", + &value_type, &value)) { if (strstr(value.addr, "right") || strstr(value.addr, "Right")) resource.mstyle.t_justify = BScreen::RightJustify; else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) @@ -1241,8 +1241,8 @@ void BScreen::LoadStyle(void) { resource.mstyle.t_justify = BScreen::LeftJustify; } if (XrmGetResource(resource.stylerc, "menu.frame.justify", - "Menu.Frame.Justify", - &value_type, &value)) { + "Menu.Frame.Justify", + &value_type, &value)) { if (strstr(value.addr, "right") || strstr(value.addr, "Right")) resource.mstyle.f_justify = BScreen::RightJustify; else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) @@ -1275,15 +1275,15 @@ void BScreen::LoadStyle(void) { resource.mstyle.bullet_pos = Basemenu::Left; } readDatabaseColor("borderColor", "BorderColor", &resource.border_color, - BlackPixel(getBaseDisplay()->getXDisplay(), - getScreenNumber())); + BlackPixel(getBaseDisplay()->getXDisplay(), + getScreenNumber())); // load bevel, border and handle widths if (XrmGetResource(resource.stylerc, "handleWidth", "HandleWidth", &value_type, &value)) { if (sscanf(value.addr, "%u", &resource.handle_width) != 1 || - resource.handle_width > (unsigned int) getWidth() / 2 || - resource.handle_width == 0) + resource.handle_width > (unsigned int) getWidth() / 2 || + resource.handle_width == 0) resource.handle_width = 6; } else { resource.handle_width = 6; @@ -1299,8 +1299,8 @@ void BScreen::LoadStyle(void) { if (XrmGetResource(resource.stylerc, "bevelWidth", "BevelWidth", &value_type, &value)) { if (sscanf(value.addr, "%u", &resource.bevel_width) != 1 || - resource.bevel_width > (unsigned int) getWidth() / 2 || - resource.bevel_width == 0) + resource.bevel_width > (unsigned int) getWidth() / 2 || + resource.bevel_width == 0) resource.bevel_width = 3; } else { resource.bevel_width = 3; @@ -1308,7 +1308,7 @@ void BScreen::LoadStyle(void) { if (XrmGetResource(resource.stylerc, "frameWidth", "FrameWidth", &value_type, &value)) { if (sscanf(value.addr, "%u", &resource.frame_width) != 1 || - resource.frame_width > (unsigned int) getWidth() / 2) + resource.frame_width > (unsigned int) getWidth() / 2) resource.frame_width = resource.bevel_width; } else { resource.frame_width = resource.bevel_width; @@ -1319,9 +1319,9 @@ void BScreen::LoadStyle(void) { #ifndef __EMX__ char displaystring[MAXPATHLEN]; sprintf(displaystring, "DISPLAY=%s", - DisplayString(getBaseDisplay()->getXDisplay())); + DisplayString(getBaseDisplay()->getXDisplay())); sprintf(displaystring + strlen(displaystring) - 1, "%d", - getScreenNumber()); + getScreenNumber()); bexec(value.addr, displaystring); #else // __EMX__ @@ -1374,7 +1374,7 @@ int BScreen::addWorkspace(void) { workspacesList->insert(wkspc); workspacemenu->insert(wkspc->getName(), wkspc->getMenu(), - wkspc->getWorkspaceID() + 2); + wkspc->getWorkspaceID() + 2); workspacemenu->update(); toolbar->reconfigure(); @@ -1417,10 +1417,10 @@ void BScreen::changeWorkspaceID(int id) { current_workspace->hideAll(); workspacemenu->setItemSelected(current_workspace->getWorkspaceID() + 2, - False); + False); if (blackbox->getFocusedWindow() && - blackbox->getFocusedWindow()->getScreen() == this && + blackbox->getFocusedWindow()->getScreen() == this && (! blackbox->getFocusedWindow()->isStuck())) { current_workspace->setLastFocusedWindow(blackbox->getFocusedWindow()); blackbox->setFocusedWindow((BlackboxWindow *) 0); @@ -1429,7 +1429,7 @@ void BScreen::changeWorkspaceID(int id) { current_workspace = getWorkspace(id); workspacemenu->setItemSelected(current_workspace->getWorkspaceID() + 2, - True); + True); toolbar->redrawWorkspaceLabel(True); current_workspace->showAll(); @@ -1454,7 +1454,7 @@ void BScreen::addNetizen(Netizen *n) { for (Workspace *w = it.current(); w; it++, w = it.current()) { for (int i = 0; i < w->getCount(); i++) n->sendWindowAdd(w->getWindow(i)->getClientWindow(), - w->getWorkspaceID()); + w->getWorkspaceID()); } Window f = ((blackbox->getFocusedWindow()) ? @@ -1639,7 +1639,7 @@ void BScreen::nextFocus(void) { if (blackbox->getFocusedWindow()) { if (blackbox->getFocusedWindow()->getScreen()->getScreenNumber() == - getScreenNumber()) { + getScreenNumber()) { have_focused = True; focused_window_number = blackbox->getFocusedWindow()->getWindowNumber(); } @@ -1649,11 +1649,11 @@ void BScreen::nextFocus(void) { int next_window_number = focused_window_number; do { if ((++next_window_number) >= getCurrentWorkspace()->getCount()) - next_window_number = 0; + next_window_number = 0; next = getCurrentWorkspace()->getWindow(next_window_number); } while ((! next->setInputFocus()) && (next_window_number != - focused_window_number)); + focused_window_number)); if (next_window_number != focused_window_number) getCurrentWorkspace()->raiseWindow(next); @@ -1673,7 +1673,7 @@ void BScreen::prevFocus(void) { if (blackbox->getFocusedWindow()) { if (blackbox->getFocusedWindow()->getScreen()->getScreenNumber() == - getScreenNumber()) { + getScreenNumber()) { have_focused = True; focused_window_number = blackbox->getFocusedWindow()->getWindowNumber(); } @@ -1683,11 +1683,11 @@ void BScreen::prevFocus(void) { int prev_window_number = focused_window_number; do { if ((--prev_window_number) < 0) - prev_window_number = getCurrentWorkspace()->getCount() - 1; + prev_window_number = getCurrentWorkspace()->getCount() - 1; prev = getCurrentWorkspace()->getWindow(prev_window_number); } while ((! prev->setInputFocus()) && (prev_window_number != - focused_window_number)); + focused_window_number)); if (prev_window_number != focused_window_number) getCurrentWorkspace()->raiseWindow(prev); @@ -1706,7 +1706,7 @@ void BScreen::raiseFocus(void) { if (blackbox->getFocusedWindow()) { if (blackbox->getFocusedWindow()->getScreen()->getScreenNumber() == - getScreenNumber()) { + getScreenNumber()) { have_focused = True; focused_window_number = blackbox->getFocusedWindow()->getWindowNumber(); } @@ -1737,47 +1737,47 @@ void BScreen::InitMenu(void) { perror(blackbox->getMenuFilename()); } else { if (feof(menu_file)) { - fprintf(stderr, i18n(ScreenSet, ScreenEmptyMenuFile, + fprintf(stderr, i18n(ScreenSet, ScreenEmptyMenuFile, "%s: Empty menu file"), - blackbox->getMenuFilename()); + blackbox->getMenuFilename()); } else { - char line[1024], label[1024]; - memset(line, 0, 1024); - memset(label, 0, 1024); - - while (fgets(line, 1024, menu_file) && ! feof(menu_file)) { - if (line[0] != '#') { - int i, key = 0, index = -1, len = strlen(line); - - key = 0; - for (i = 0; i < len; i++) { - if (line[i] == '[') index = 0; - else if (line[i] == ']') break; - else if (line[i] != ' ') - if (index++ >= 0) - key += tolower(line[i]); - } - - if (key == 517) { - index = -1; - for (i = index; i < len; i++) { - if (line[i] == '(') index = 0; - else if (line[i] == ')') break; - else if (index++ >= 0) { - if (line[i] == '\\' && i < len - 1) i++; - label[index - 1] = line[i]; - } - } - - if (index == -1) index = 0; - label[index] = '\0'; - - rootmenu->setLabel(label); - defaultMenu = parseMenuFile(menu_file, rootmenu); - break; - } - } - } + char line[1024], label[1024]; + memset(line, 0, 1024); + memset(label, 0, 1024); + + while (fgets(line, 1024, menu_file) && ! feof(menu_file)) { + if (line[0] != '#') { + int i, key = 0, index = -1, len = strlen(line); + + key = 0; + for (i = 0; i < len; i++) { + if (line[i] == '[') index = 0; + else if (line[i] == ']') break; + else if (line[i] != ' ') + if (index++ >= 0) + key += tolower(line[i]); + } + + if (key == 517) { + index = -1; + for (i = index; i < len; i++) { + if (line[i] == '(') index = 0; + else if (line[i] == ')') break; + else if (index++ >= 0) { + if (line[i] == '\\' && i < len - 1) i++; + label[index - 1] = line[i]; + } + } + + if (index == -1) index = 0; + label[index] = '\0'; + + rootmenu->setLabel(label); + defaultMenu = parseMenuFile(menu_file, rootmenu); + break; + } + } + } } fclose(menu_file); } @@ -1786,12 +1786,12 @@ void BScreen::InitMenu(void) { if (defaultMenu) { rootmenu->setInternalMenu(); rootmenu->insert(i18n(ScreenSet, Screenxterm, "xterm"), - BScreen::Execute, - i18n(ScreenSet, Screenxterm, "xterm")); + BScreen::Execute, + i18n(ScreenSet, Screenxterm, "xterm")); rootmenu->insert(i18n(ScreenSet, ScreenRestart, "Restart"), - BScreen::Restart); + BScreen::Restart); rootmenu->insert(i18n(ScreenSet, ScreenExit, "Exit"), - BScreen::Exit); + BScreen::Exit); } else { blackbox->saveMenuFilename(blackbox->getMenuFilename()); } @@ -1808,131 +1808,131 @@ Bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) { if (fgets(line, 1024, file)) { if (line[0] != '#') { - register int i, key = 0, parse = 0, index = -1, - line_length = strlen(line), - label_length = 0, command_length = 0; - - // determine the keyword - key = 0; - for (i = 0; i < line_length; i++) { - if (line[i] == '[') parse = 1; - else if (line[i] == ']') break; - else if (line[i] != ' ') - if (parse) - key += tolower(line[i]); - } - - // get the label enclosed in ()'s - parse = 0; - - for (i = 0; i < line_length; i++) { - if (line[i] == '(') { - index = 0; - parse = 1; - } else if (line[i] == ')') break; - else if (index++ >= 0) { - if (line[i] == '\\' && i < line_length - 1) i++; - label[index - 1] = line[i]; - } - } - - if (parse) { - label[index] = '\0'; - label_length = index; - } else { - label[0] = '\0'; - label_length = 0; - } - - // get the command enclosed in {}'s - parse = 0; - index = -1; - for (i = 0; i < line_length; i++) { - if (line[i] == '{') { - index = 0; - parse = 1; - } else if (line[i] == '}') break; - else if (index++ >= 0) { - if (line[i] == '\\' && i < line_length - 1) i++; - command[index - 1] = line[i]; - } - } - - if (parse) { - command[index] = '\0'; - command_length = index; - } else { - command[0] = '\0'; - command_length = 0; - } - - switch (key) { + register int i, key = 0, parse = 0, index = -1, + line_length = strlen(line), + label_length = 0, command_length = 0; + + // determine the keyword + key = 0; + for (i = 0; i < line_length; i++) { + if (line[i] == '[') parse = 1; + else if (line[i] == ']') break; + else if (line[i] != ' ') + if (parse) + key += tolower(line[i]); + } + + // get the label enclosed in ()'s + parse = 0; + + for (i = 0; i < line_length; i++) { + if (line[i] == '(') { + index = 0; + parse = 1; + } else if (line[i] == ')') break; + else if (index++ >= 0) { + if (line[i] == '\\' && i < line_length - 1) i++; + label[index - 1] = line[i]; + } + } + + if (parse) { + label[index] = '\0'; + label_length = index; + } else { + label[0] = '\0'; + label_length = 0; + } + + // get the command enclosed in {}'s + parse = 0; + index = -1; + for (i = 0; i < line_length; i++) { + if (line[i] == '{') { + index = 0; + parse = 1; + } else if (line[i] == '}') break; + else if (index++ >= 0) { + if (line[i] == '\\' && i < line_length - 1) i++; + command[index - 1] = line[i]; + } + } + + if (parse) { + command[index] = '\0'; + command_length = index; + } else { + command[0] = '\0'; + command_length = 0; + } + + switch (key) { case 311: //end return ((menu->getCount() == 0) ? True : False); break; case 333: // nop - menu->insert(label); + menu->insert(label); - break; + break; - case 421: // exec - if ((! *label) && (! *command)) { - fprintf(stderr, i18n(ScreenSet, ScreenEXECError, + case 421: // exec + if ((! *label) && (! *command)) { + fprintf(stderr, i18n(ScreenSet, ScreenEXECError, "BScreen::parseMenuFile: [exec] error, " "no menu label and/or command defined\n")); - continue; - } + continue; + } - menu->insert(label, BScreen::Execute, command); + menu->insert(label, BScreen::Execute, command); - break; + break; - case 442: // exit - if (! *label) { - fprintf(stderr, i18n(ScreenSet, ScreenEXITError, + case 442: // exit + if (! *label) { + fprintf(stderr, i18n(ScreenSet, ScreenEXITError, "BScreen::parseMenuFile: [exit] error, " "no menu label defined\n")); - continue; - } + continue; + } - menu->insert(label, BScreen::Exit); + menu->insert(label, BScreen::Exit); - break; + break; - case 561: // style - { - if ((! *label) || (! *command)) { - fprintf(stderr, + case 561: // style + { + if ((! *label) || (! *command)) { + fprintf(stderr, i18n(ScreenSet, ScreenSTYLEError, "BScreen::parseMenuFile: [style] error, " "no menu label and/or filename defined\n")); - continue; - } + continue; + } - char *style = expandTilde(command); + char *style = expandTilde(command); - menu->insert(label, BScreen::SetStyle, style); + menu->insert(label, BScreen::SetStyle, style); - delete [] style; - } + delete [] style; + } - break; + break; - case 630: // config - if (! *label) { - fprintf(stderr, i18n(ScreenSet, ScreenCONFIGError, + case 630: // config + if (! *label) { + fprintf(stderr, i18n(ScreenSet, ScreenCONFIGError, "BScreen::parseMenufile: [config] error, " "no label defined")); - continue; - } + continue; + } - menu->insert(label, configmenu); + menu->insert(label, configmenu); - break; + break; - case 740: // include + case 740: // include { if (! *label) { fprintf(stderr, i18n(ScreenSet, ScreenINCLUDEError, @@ -1968,63 +1968,63 @@ Bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) { delete [] newfile; } - break; + break; - case 767: // submenu - { - if (! *label) { - fprintf(stderr, i18n(ScreenSet, ScreenSUBMENUError, + case 767: // submenu + { + if (! *label) { + fprintf(stderr, i18n(ScreenSet, ScreenSUBMENUError, "BScreen::parseMenuFile: [submenu] error, " "no menu label defined\n")); - continue; - } + continue; + } - Rootmenu *submenu = new Rootmenu(this); + Rootmenu *submenu = new Rootmenu(this); - if (*command) - submenu->setLabel(command); - else - submenu->setLabel(label); + if (*command) + submenu->setLabel(command); + else + submenu->setLabel(label); - parseMenuFile(file, submenu); - submenu->update(); - menu->insert(label, submenu); - rootmenuList->insert(submenu); - } + parseMenuFile(file, submenu); + submenu->update(); + menu->insert(label, submenu); + rootmenuList->insert(submenu); + } - break; + break; - case 773: // restart - { - if (! *label) { - fprintf(stderr, i18n(ScreenSet, ScreenRESTARTError, + case 773: // restart + { + if (! *label) { + fprintf(stderr, i18n(ScreenSet, ScreenRESTARTError, "BScreen::parseMenuFile: [restart] error, " "no menu label defined\n")); - continue; - } + continue; + } - if (*command) - menu->insert(label, BScreen::RestartOther, command); - else - menu->insert(label, BScreen::Restart); - } + if (*command) + menu->insert(label, BScreen::RestartOther, command); + else + menu->insert(label, BScreen::Restart); + } - break; + break; - case 845: // reconfig - { - if (! *label) { - fprintf(stderr, + case 845: // reconfig + { + if (! *label) { + fprintf(stderr, i18n(ScreenSet, ScreenRECONFIGError, "BScreen::parseMenuFile: [reconfig] error, " "no menu label defined\n")); - continue; - } + continue; + } - menu->insert(label, BScreen::Reconfigure); - } + menu->insert(label, BScreen::Reconfigure); + } - break; + break; case 995: // stylesdir case 1113: // stylesmenu @@ -2033,7 +2033,7 @@ Bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) { if ((! *label) || ((! *command) && newmenu)) { fprintf(stderr, - i18n(ScreenSet, ScreenSTYLESDIRError, + i18n(ScreenSet, ScreenSTYLESDIRError, "BScreen::parseMenuFile: [stylesdir/stylesmenu]" " error, no directory defined\n")); continue; @@ -2041,7 +2041,7 @@ Bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) { char *directory = ((newmenu) ? command : label); - char *stylesdir = expandTilde(directory); + char *stylesdir = expandTilde(directory); struct stat statbuf; @@ -2065,11 +2065,11 @@ Bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) { char **ls = new char* [entries]; int index = 0; while ((p = readdir(d))) - ls[index++] = bstrdup(p->d_name); + ls[index++] = bstrdup(p->d_name); - closedir(d); + closedir(d); - std::sort(ls, ls + entries, dcmp()); + std::sort(ls, ls + entries, dcmp()); int n, slen = strlen(stylesdir); for (n = 0; n < entries; n++) { @@ -2108,29 +2108,29 @@ Bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) { } } else { fprintf(stderr, - i18n(ScreenSet, ScreenSTYLESDIRErrorNoExist, + i18n(ScreenSet, ScreenSTYLESDIRErrorNoExist, "BScreen::parseMenuFile: [stylesdir/stylesmenu]" " error, %s does not exist\n"), stylesdir); } - delete [] stylesdir; + delete [] stylesdir; break; } - case 1090: // workspaces - { - if (! *label) { - fprintf(stderr, - i18n(ScreenSet, ScreenWORKSPACESError, + case 1090: // workspaces + { + if (! *label) { + fprintf(stderr, + i18n(ScreenSet, ScreenWORKSPACESError, "BScreen:parseMenuFile: [workspaces] error, " "no menu label defined\n")); - continue; - } + continue; + } - menu->insert(label, workspacemenu); + menu->insert(label, workspacemenu); - break; - } - } + break; + } + } } } } @@ -2182,16 +2182,16 @@ void BScreen::showPosition(int x, int y) { if (i18n.multibyte()) { XmbDrawString(getBaseDisplay()->getXDisplay(), geom_window, - resource.wstyle.fontset, resource.wstyle.l_text_focus_gc, - resource.bevel_width, resource.bevel_width - - resource.wstyle.fontset_extents->max_ink_extent.y, - label, strlen(label)); + resource.wstyle.fontset, resource.wstyle.l_text_focus_gc, + resource.bevel_width, resource.bevel_width - + resource.wstyle.fontset_extents->max_ink_extent.y, + label, strlen(label)); } else { XDrawString(getBaseDisplay()->getXDisplay(), geom_window, - resource.wstyle.l_text_focus_gc, - resource.bevel_width, - resource.wstyle.font->ascent + - resource.bevel_width, label, strlen(label)); + resource.wstyle.l_text_focus_gc, + resource.bevel_width, + resource.wstyle.font->ascent + + resource.bevel_width, label, strlen(label)); } } @@ -2216,16 +2216,16 @@ void BScreen::showGeometry(unsigned int gx, unsigned int gy) { if (i18n.multibyte()) { XmbDrawString(getBaseDisplay()->getXDisplay(), geom_window, - resource.wstyle.fontset, resource.wstyle.l_text_focus_gc, - resource.bevel_width, resource.bevel_width - - resource.wstyle.fontset_extents->max_ink_extent.y, - label, strlen(label)); + resource.wstyle.fontset, resource.wstyle.l_text_focus_gc, + resource.bevel_width, resource.bevel_width - + resource.wstyle.fontset_extents->max_ink_extent.y, + label, strlen(label)); } else { XDrawString(getBaseDisplay()->getXDisplay(), geom_window, - resource.wstyle.l_text_focus_gc, - resource.bevel_width, - resource.wstyle.font->ascent + - resource.bevel_width, label, strlen(label)); + resource.wstyle.l_text_focus_gc, + resource.bevel_width, + resource.wstyle.font->ascent + + resource.bevel_width, label, strlen(label)); } } diff --git a/src/Slit.cc b/src/Slit.cc index 97293731..f5c1e62e 100644 --- a/src/Slit.cc +++ b/src/Slit.cc @@ -70,7 +70,7 @@ Slit::Slit(BScreen *scr) { frame.window = XCreateWindow(display, screen->getRootWindow(), frame.x, frame.y, - frame.width, frame.height, screen->getBorderWidth(), + frame.width, frame.height, screen->getBorderWidth(), screen->getDepth(), InputOutput, screen->getVisual(), create_mask, &attrib); blackbox->saveSlitSearch(frame.window, this); @@ -105,16 +105,16 @@ void Slit::addClient(Window w) { if (wmhints) { if ((wmhints->flags & IconWindowHint) && - (wmhints->icon_window != None)) { - XMoveWindow(display, client->client_window, screen->getWidth() + 10, - screen->getHeight() + 10); - XMapWindow(display, client->client_window); + (wmhints->icon_window != None)) { + XMoveWindow(display, client->client_window, screen->getWidth() + 10, + screen->getHeight() + 10); + XMapWindow(display, client->client_window); - client->icon_window = wmhints->icon_window; - client->window = client->icon_window; + client->icon_window = wmhints->icon_window; + client->window = client->icon_window; } else { - client->icon_window = None; - client->window = client->client_window; + client->icon_window = None; + client->window = client->client_window; } XFree(wmhints); @@ -141,7 +141,7 @@ void Slit::addClient(Window w) { XChangeSaveSet(display, client->window, SetModeInsert); XSelectInput(display, frame.window, SubstructureRedirectMask | - ButtonPressMask | EnterWindowMask | LeaveWindowMask); + ButtonPressMask | EnterWindowMask | LeaveWindowMask); XSelectInput(display, client->window, StructureNotifyMask | SubstructureNotifyMask | EnterWindowMask); XFlush(display); @@ -166,10 +166,10 @@ void Slit::removeClient(SlitClient *client, Bool remap) { XSelectInput(display, frame.window, NoEventMask); XSelectInput(display, client->window, NoEventMask); XReparentWindow(display, client->window, screen->getRootWindow(), - client->x, client->y); + client->x, client->y); XChangeSaveSet(display, client->window, SetModeDelete); XSelectInput(display, frame.window, SubstructureRedirectMask | - ButtonPressMask | EnterWindowMask | LeaveWindowMask); + ButtonPressMask | EnterWindowMask | LeaveWindowMask); XFlush(display); } @@ -260,10 +260,10 @@ void Slit::reconfigure(void) { if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { frame.pixmap = None; XSetWindowBackground(display, frame.window, - texture->getColor()->getPixel()); + texture->getColor()->getPixel()); } else { frame.pixmap = image_ctrl->renderImage(frame.width, frame.height, - texture); + texture); XSetWindowBackgroundPixmap(display, frame.window, frame.pixmap); } if (tmp) image_ctrl->removeImage(tmp); @@ -397,12 +397,12 @@ void Slit::reposition(void) { frame.y = 0; if (screen->getSlitDirection() == Vertical) { frame.x_hidden = screen->getBevelWidth() - screen->getBorderWidth() - - frame.width; + - frame.width; frame.y_hidden = 0; } else { frame.x_hidden = 0; frame.y_hidden = screen->getBevelWidth() - screen->getBorderWidth() - - frame.height; + - frame.height; } break; @@ -410,7 +410,7 @@ void Slit::reposition(void) { frame.x = 0; frame.y = (screen->getHeight() - frame.height) / 2; frame.x_hidden = screen->getBevelWidth() - screen->getBorderWidth() - - frame.width; + - frame.width; frame.y_hidden = frame.y; break; @@ -420,12 +420,12 @@ void Slit::reposition(void) { - (screen->getBorderWidth() * 2); if (screen->getSlitDirection() == Vertical) { frame.x_hidden = screen->getBevelWidth() - screen->getBorderWidth() - - frame.width; + - frame.width; frame.y_hidden = frame.y; } else { frame.x_hidden = 0; frame.y_hidden = screen->getHeight() - screen->getBevelWidth() - - screen->getBorderWidth(); + - screen->getBorderWidth(); } break; @@ -452,7 +452,7 @@ void Slit::reposition(void) { frame.y = 0; if (screen->getSlitDirection() == Vertical) { frame.x_hidden = screen->getWidth() - screen->getBevelWidth() - - screen->getBorderWidth(); + - screen->getBorderWidth(); frame.y_hidden = 0; } else { frame.x_hidden = frame.x; @@ -478,7 +478,7 @@ void Slit::reposition(void) { - (screen->getBorderWidth() * 2); if (screen->getSlitDirection() == Vertical) { frame.x_hidden = screen->getWidth() - screen->getBevelWidth() - - screen->getBorderWidth(); + - screen->getBorderWidth(); frame.y_hidden = frame.y; } else { frame.x_hidden = frame.x; @@ -501,22 +501,22 @@ void Slit::reposition(void) { if (screen->getSlitDirection() == Vertical) frame.y_hidden += tbar->getExposedHeight(); else - frame.y_hidden = frame.y; + frame.y_hidden = frame.y; } else { frame.y -= tbar->getExposedHeight(); if (screen->getSlitDirection() == Vertical) frame.y_hidden -= tbar->getExposedHeight(); else - frame.y_hidden = frame.y; + frame.y_hidden = frame.y; } } if (hidden) XMoveResizeWindow(display, frame.window, frame.x_hidden, - frame.y_hidden, frame.width, frame.height); + frame.y_hidden, frame.width, frame.height); else XMoveResizeWindow(display, frame.window, frame.x, - frame.y, frame.width, frame.height); + frame.y, frame.width, frame.height); } @@ -638,9 +638,9 @@ Slitmenu::Slitmenu(Slit *sl) : Basemenu(sl->screen) { placementmenu = new Placementmenu(this); insert(i18n(CommonSet, CommonDirectionTitle, "Direction"), - directionmenu); + directionmenu); insert(i18n(CommonSet, CommonPlacementTitle, "Placement"), - placementmenu); + placementmenu); insert(i18n(CommonSet, CommonAlwaysOnTop, "Always on top"), 1); insert(i18n(CommonSet, CommonAutoHide, "Auto hide"), 2); @@ -708,9 +708,9 @@ Slitmenu::Directionmenu::Directionmenu(Slitmenu *sm) setInternalMenu(); insert(i18n(CommonSet, CommonDirectionHoriz, "Horizontal"), - Slit::Horizontal); + Slit::Horizontal); insert(i18n(CommonSet, CommonDirectionVert, "Vertical"), - Slit::Vertical); + Slit::Vertical); update(); @@ -752,25 +752,25 @@ Slitmenu::Placementmenu::Placementmenu(Slitmenu *sm) setInternalMenu(); insert(i18n(CommonSet, CommonPlacementTopLeft, "Top Left"), - Slit::TopLeft); + Slit::TopLeft); insert(i18n(CommonSet, CommonPlacementCenterLeft, "Center Left"), - Slit::CenterLeft); + Slit::CenterLeft); insert(i18n(CommonSet, CommonPlacementBottomLeft, "Bottom Left"), - Slit::BottomLeft); + Slit::BottomLeft); insert(i18n(CommonSet, CommonPlacementTopCenter, "Top Center"), - Slit::TopCenter); + Slit::TopCenter); insert(""); insert(i18n(CommonSet, CommonPlacementBottomCenter, - "Bottom Center"), - Slit::BottomCenter); + "Bottom Center"), + Slit::BottomCenter); insert(i18n(CommonSet, CommonPlacementTopRight, "Top Right"), - Slit::TopRight); + Slit::TopRight); insert(i18n(CommonSet, CommonPlacementCenterRight, - "Center Right"), - Slit::CenterRight); + "Center Right"), + Slit::CenterRight); insert(i18n(CommonSet, CommonPlacementBottomRight, - "Bottom Right"), - Slit::BottomRight); + "Bottom Right"), + Slit::BottomRight); update(); } diff --git a/src/Timer.cc b/src/Timer.cc index 9b793ae4..df9a53fd 100644 --- a/src/Timer.cc +++ b/src/Timer.cc @@ -97,5 +97,5 @@ bool BTimer::shouldFire(const timeval &tm) const { timeval end = endpoint(); return !((tm.tv_sec < end.tv_sec) || - (tm.tv_sec == end.tv_sec && tm.tv_usec < end.tv_usec)); + (tm.tv_sec == end.tv_sec && tm.tv_usec < end.tv_usec)); } diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 412044e8..9655473f 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -104,8 +104,8 @@ Toolbar::Toolbar(BScreen *scrn) { frame.window = XCreateWindow(display, screen->getRootWindow(), 0, 0, 1, 1, 0, - screen->getDepth(), InputOutput, screen->getVisual(), - create_mask, &attrib); + screen->getDepth(), InputOutput, screen->getVisual(), + create_mask, &attrib); blackbox->saveToolbarSearch(frame.window, this); attrib.event_mask = ButtonPressMask | ButtonReleaseMask | ExposureMask | @@ -113,17 +113,17 @@ Toolbar::Toolbar(BScreen *scrn) { frame.workspace_label = XCreateWindow(display, frame.window, 0, 0, 1, 1, 0, screen->getDepth(), - InputOutput, screen->getVisual(), create_mask, &attrib); + InputOutput, screen->getVisual(), create_mask, &attrib); blackbox->saveToolbarSearch(frame.workspace_label, this); frame.window_label = XCreateWindow(display, frame.window, 0, 0, 1, 1, 0, screen->getDepth(), - InputOutput, screen->getVisual(), create_mask, &attrib); + InputOutput, screen->getVisual(), create_mask, &attrib); blackbox->saveToolbarSearch(frame.window_label, this); frame.clock = XCreateWindow(display, frame.window, 0, 0, 1, 1, 0, screen->getDepth(), - InputOutput, screen->getVisual(), create_mask, &attrib); + InputOutput, screen->getVisual(), create_mask, &attrib); blackbox->saveToolbarSearch(frame.clock, this); frame.psbutton = @@ -198,7 +198,7 @@ void Toolbar::reconfigure(void) { screen->getToolbarStyle()->fontset_extents->max_ink_extent.height; else frame.height = screen->getToolbarStyle()->font->ascent + - screen->getToolbarStyle()->font->descent; + screen->getToolbarStyle()->font->descent; frame.button_w = frame.height; frame.height += 2; frame.label_h = frame.height; @@ -291,13 +291,13 @@ void Toolbar::reconfigure(void) { *(time_string + len) = '\0'; if (i18n.multibyte()) { - XRectangle ink, logical; - XmbTextExtents(screen->getToolbarStyle()->fontset, time_string, len, - &ink, &logical); - frame.clock_w = logical.width; + XRectangle ink, logical; + XmbTextExtents(screen->getToolbarStyle()->fontset, time_string, len, + &ink, &logical); + frame.clock_w = logical.width; } else { - frame.clock_w = XTextWidth(screen->getToolbarStyle()->font, - time_string, len); + frame.clock_w = XTextWidth(screen->getToolbarStyle()->font, + time_string, len); } frame.clock_w += (frame.bevel_w * 4); @@ -311,8 +311,8 @@ void Toolbar::reconfigure(void) { #else // !HAVE_STRFTIME frame.clock_w = XTextWidth(screen->getToolbarStyle()->font, - i18n(ToolbarSet, ToolbarNoStrftimeLength, "00:00000"), - strlen(i18n(ToolbarSet, ToolbarNoStrftimeLength, + i18n(ToolbarSet, ToolbarNoStrftimeLength, "00:00000"), + strlen(i18n(ToolbarSet, ToolbarNoStrftimeLength, "00:00000"))) + (frame.bevel_w * 4); #endif // HAVE_STRFTIME @@ -324,14 +324,14 @@ void Toolbar::reconfigure(void) { if (i18n.multibyte()) { XRectangle ink, logical; XmbTextExtents(screen->getToolbarStyle()->fontset, - screen->getWorkspace(i)->getName(), - strlen(screen->getWorkspace(i)->getName()), - &ink, &logical); + screen->getWorkspace(i)->getName(), + strlen(screen->getWorkspace(i)->getName()), + &ink, &logical); w = logical.width; } else { w = XTextWidth(screen->getToolbarStyle()->font, - screen->getWorkspace(i)->getName(), - strlen(screen->getWorkspace(i)->getName())); + screen->getWorkspace(i)->getName(), + strlen(screen->getWorkspace(i)->getName())); } w += (frame.bevel_w * 4); @@ -349,14 +349,14 @@ void Toolbar::reconfigure(void) { if (hidden) { XMoveResizeWindow(display, frame.window, frame.x_hidden, frame.y_hidden, - frame.width, frame.height); + frame.width, frame.height); } else { XMoveResizeWindow(display, frame.window, frame.x, frame.y, - frame.width, frame.height); + frame.width, frame.height); } XMoveResizeWindow(display, frame.workspace_label, frame.bevel_w, - frame.bevel_w, frame.workspace_label_w, + frame.bevel_w, frame.workspace_label_w, frame.label_h); XMoveResizeWindow(display, frame.psbutton, (frame.bevel_w * 2) + frame.workspace_label_w + 1, frame.bevel_w + 1, @@ -366,7 +366,7 @@ void Toolbar::reconfigure(void) { frame.bevel_w + 1, frame.button_w, frame.button_w); XMoveResizeWindow(display, frame.window_label, (frame.bevel_w * 4) + (frame.button_w * 2) + frame.workspace_label_w + 3, - frame.bevel_w, frame.window_label_w, frame.label_h); + frame.bevel_w, frame.window_label_w, frame.label_h); XMoveResizeWindow(display, frame.pwbutton, (frame.bevel_w * 5) + (frame.button_w * 2) + frame.workspace_label_w + frame.window_label_w + 4, frame.bevel_w + 1, @@ -376,15 +376,15 @@ void Toolbar::reconfigure(void) { frame.window_label_w + 5, frame.bevel_w + 1, frame.button_w, frame.button_w); XMoveResizeWindow(display, frame.clock, frame.width - frame.clock_w - - frame.bevel_w, frame.bevel_w, frame.clock_w, - frame.label_h); + frame.bevel_w, frame.bevel_w, frame.clock_w, + frame.label_h); Pixmap tmp = frame.base; BTexture *texture = &(screen->getToolbarStyle()->toolbar); if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { frame.base = None; XSetWindowBackground(display, frame.window, - texture->getColor()->getPixel()); + texture->getColor()->getPixel()); } else { frame.base = image_ctrl->renderImage(frame.width, frame.height, texture); @@ -397,7 +397,7 @@ void Toolbar::reconfigure(void) { if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { frame.label = None; XSetWindowBackground(display, frame.window_label, - texture->getColor()->getPixel()); + texture->getColor()->getPixel()); } else { frame.label = image_ctrl->renderImage(frame.window_label_w, frame.label_h, texture); @@ -410,7 +410,7 @@ void Toolbar::reconfigure(void) { if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { frame.wlabel = None; XSetWindowBackground(display, frame.workspace_label, - texture->getColor()->getPixel()); + texture->getColor()->getPixel()); } else { frame.wlabel = image_ctrl->renderImage(frame.workspace_label_w, frame.label_h,texture); @@ -423,7 +423,7 @@ void Toolbar::reconfigure(void) { if (texture->getTexture() == (BImage_Flat | BImage_Solid)) { frame.clk = None; XSetWindowBackground(display, frame.clock, - texture->getColor()->getPixel()); + texture->getColor()->getPixel()); } else { frame.clk = image_ctrl->renderImage(frame.clock_w, frame.label_h, texture); @@ -464,7 +464,7 @@ void Toolbar::reconfigure(void) { if (tmp) image_ctrl->removeImage(tmp); XSetWindowBorder(display, frame.window, - screen->getBorderColor()->getPixel()); + screen->getBorderColor()->getPixel()); XSetWindowBorderWidth(display, frame.window, screen->getBorderWidth()); XClearWindow(display, frame.window); @@ -518,28 +518,28 @@ void Toolbar::checkClock(Bool redraw, Bool date) { if (screen->getDateFormat() == Blackbox::B_EuropeanDate) sprintf(t, 18n(ToolbarSet, ToolbarNoStrftimeDateFormatEu, "%02d.%02d.%02d"), - tt->tm_mday, tt->tm_mon + 1, + tt->tm_mday, tt->tm_mon + 1, (tt->tm_year >= 100) ? tt->tm_year - 100 : tt->tm_year); else sprintf(t, i18n(ToolbarSet, ToolbarNoStrftimeDateFormat, "%02d/%02d/%02d"), - tt->tm_mon + 1, tt->tm_mday, + tt->tm_mon + 1, tt->tm_mday, (tt->tm_year >= 100) ? tt->tm_year - 100 : tt->tm_year); } else { if (screen->isClock24Hour()) - sprintf(t, i18n(ToolbarSet, ToolbarNoStrftimeTimeFormat24, + sprintf(t, i18n(ToolbarSet, ToolbarNoStrftimeTimeFormat24, " %02d:%02d "), - frame.hour, frame.minute); + frame.hour, frame.minute); else - sprintf(t, i18n(ToolbarSet, ToolbarNoStrftimeTimeFormat12, + sprintf(t, i18n(ToolbarSet, ToolbarNoStrftimeTimeFormat12, "%02d:%02d %sm"), - ((frame.hour > 12) ? frame.hour - 12 : - ((frame.hour == 0) ? 12 : frame.hour)), frame.minute, - ((frame.hour >= 12) ? - i18n(ToolbarSet, - ToolbarNoStrftimeTimeFormatP, "p") : - i18n(ToolbarSet, - ToolbarNoStrftimeTimeFormatA, "a"))); + ((frame.hour > 12) ? frame.hour - 12 : + ((frame.hour == 0) ? 12 : frame.hour)), frame.minute, + ((frame.hour >= 12) ? + i18n(ToolbarSet, + ToolbarNoStrftimeTimeFormatP, "p") : + i18n(ToolbarSet, + ToolbarNoStrftimeTimeFormatA, "a"))); } #endif // HAVE_STRFTIME @@ -549,7 +549,7 @@ void Toolbar::checkClock(Bool redraw, Bool date) { if (i18n.multibyte()) { XRectangle ink, logical; XmbTextExtents(screen->getToolbarStyle()->fontset, - t, dlen, &ink, &logical); + t, dlen, &ink, &logical); l = logical.width; } else { l = XTextWidth(screen->getToolbarStyle()->font, t, dlen); @@ -559,16 +559,16 @@ void Toolbar::checkClock(Bool redraw, Bool date) { if (l > frame.clock_w) { for (; dlen >= 0; dlen--) { - if (i18n.multibyte()) { - XRectangle ink, logical; - XmbTextExtents(screen->getToolbarStyle()->fontset, - t, dlen, &ink, &logical); - l = logical.width; - } else { - l = XTextWidth(screen->getToolbarStyle()->font, t, dlen); - } - l+= (frame.bevel_w * 4); - + if (i18n.multibyte()) { + XRectangle ink, logical; + XmbTextExtents(screen->getToolbarStyle()->fontset, + t, dlen, &ink, &logical); + l = logical.width; + } else { + l = XTextWidth(screen->getToolbarStyle()->font, t, dlen); + } + l+= (frame.bevel_w * 4); + if (l < frame.clock_w) break; } @@ -586,11 +586,11 @@ void Toolbar::checkClock(Bool redraw, Bool date) { ToolbarStyle *style = screen->getToolbarStyle(); if (i18n.multibyte()) XmbDrawString(display, frame.clock, style->fontset, style->c_text_gc, - dx, (1 - style->fontset_extents->max_ink_extent.y), - t, dlen); + dx, (1 - style->fontset_extents->max_ink_extent.y), + t, dlen); else XDrawString(display, frame.clock, style->c_text_gc, dx, - (style->font->ascent + 1), t, dlen); + (style->font->ascent + 1), t, dlen); } } @@ -609,7 +609,7 @@ void Toolbar::redrawWindowLabel(Bool redraw) { if (i18n.multibyte()) { XRectangle ink, logical; XmbTextExtents(screen->getToolbarStyle()->fontset, *foc->getTitle(), - dlen, &ink, &logical); + dlen, &ink, &logical); l = logical.width; } else { l = XTextWidth(screen->getToolbarStyle()->font, *foc->getTitle(), dlen); @@ -618,18 +618,18 @@ void Toolbar::redrawWindowLabel(Bool redraw) { if (l > frame.window_label_w) { for (; dlen >= 0; dlen--) { - if (i18n.multibyte()) { - XRectangle ink, logical; - XmbTextExtents(screen->getToolbarStyle()->fontset, - *foc->getTitle(), dlen, &ink, &logical); - l = logical.width; - } else { - l = XTextWidth(screen->getToolbarStyle()->font, - *foc->getTitle(), dlen); - } - l += (frame.bevel_w * 4); - - if (l < frame.window_label_w) + if (i18n.multibyte()) { + XRectangle ink, logical; + XmbTextExtents(screen->getToolbarStyle()->fontset, + *foc->getTitle(), dlen, &ink, &logical); + l = logical.width; + } else { + l = XTextWidth(screen->getToolbarStyle()->font, + *foc->getTitle(), dlen); + } + l += (frame.bevel_w * 4); + + if (l < frame.window_label_w) break; } } @@ -646,12 +646,12 @@ void Toolbar::redrawWindowLabel(Bool redraw) { ToolbarStyle *style = screen->getToolbarStyle(); if (i18n.multibyte()) XmbDrawString(display, frame.window_label, style->fontset, - style->w_text_gc, dx, - (1 - style->fontset_extents->max_ink_extent.y), - *foc->getTitle(), dlen); + style->w_text_gc, dx, + (1 - style->fontset_extents->max_ink_extent.y), + *foc->getTitle(), dlen); else XDrawString(display, frame.window_label, style->w_text_gc, dx, - (style->font->ascent + 1), *foc->getTitle(), dlen); + (style->font->ascent + 1), *foc->getTitle(), dlen); } else { XClearWindow(display, frame.window_label); } @@ -664,35 +664,35 @@ void Toolbar::redrawWorkspaceLabel(Bool redraw) { XClearWindow(display, frame.workspace_label); int dx = (frame.bevel_w * 2), dlen = - strlen(screen->getCurrentWorkspace()->getName()); + strlen(screen->getCurrentWorkspace()->getName()); unsigned int l; if (i18n.multibyte()) { XRectangle ink, logical; XmbTextExtents(screen->getToolbarStyle()->fontset, - screen->getCurrentWorkspace()->getName(), dlen, - &ink, &logical); + screen->getCurrentWorkspace()->getName(), dlen, + &ink, &logical); l = logical.width; } else { l = XTextWidth(screen->getToolbarStyle()->font, - screen->getCurrentWorkspace()->getName(), dlen); + screen->getCurrentWorkspace()->getName(), dlen); } l += (frame.bevel_w * 4); if (l > frame.workspace_label_w) { for (; dlen >= 0; dlen--) { - if (i18n.multibyte()) { - XRectangle ink, logical; - XmbTextExtents(screen->getToolbarStyle()->fontset, - screen->getCurrentWorkspace()->getName(), dlen, - &ink, &logical); - l = logical.width; - } else { - l = XTextWidth(screen->getWindowStyle()->font, - screen->getCurrentWorkspace()->getName(), dlen); - } - l += (frame.bevel_w * 4); - + if (i18n.multibyte()) { + XRectangle ink, logical; + XmbTextExtents(screen->getToolbarStyle()->fontset, + screen->getCurrentWorkspace()->getName(), dlen, + &ink, &logical); + l = logical.width; + } else { + l = XTextWidth(screen->getWindowStyle()->font, + screen->getCurrentWorkspace()->getName(), dlen); + } + l += (frame.bevel_w * 4); + if (l < frame.workspace_label_w) break; } @@ -710,13 +710,13 @@ void Toolbar::redrawWorkspaceLabel(Bool redraw) { ToolbarStyle *style = screen->getToolbarStyle(); if (i18n.multibyte()) XmbDrawString(display, frame.workspace_label, style->fontset, - style->l_text_gc, dx, - (1 - style->fontset_extents->max_ink_extent.y), - (char *) screen->getCurrentWorkspace()->getName(), dlen); + style->l_text_gc, dx, + (1 - style->fontset_extents->max_ink_extent.y), + (char *) screen->getCurrentWorkspace()->getName(), dlen); else XDrawString(display, frame.workspace_label, style->l_text_gc, dx, - (style->font->ascent + 1), - (char *) screen->getCurrentWorkspace()->getName(), dlen); + (style->font->ascent + 1), + (char *) screen->getCurrentWorkspace()->getName(), dlen); } } @@ -725,14 +725,14 @@ void Toolbar::redrawPrevWorkspaceButton(Bool pressed, Bool redraw) { if (redraw) { if (pressed) { if (frame.pbutton) - XSetWindowBackgroundPixmap(display, frame.psbutton, frame.pbutton); + XSetWindowBackgroundPixmap(display, frame.psbutton, frame.pbutton); else - XSetWindowBackground(display, frame.psbutton, frame.pbutton_pixel); + XSetWindowBackground(display, frame.psbutton, frame.pbutton_pixel); } else { if (frame.button) XSetWindowBackgroundPixmap(display, frame.psbutton, frame.button); else - XSetWindowBackground(display, frame.psbutton, frame.button_pixel); + XSetWindowBackground(display, frame.psbutton, frame.button_pixel); } XClearWindow(display, frame.psbutton); } @@ -753,14 +753,14 @@ void Toolbar::redrawNextWorkspaceButton(Bool pressed, Bool redraw) { if (redraw) { if (pressed) { if (frame.pbutton) - XSetWindowBackgroundPixmap(display, frame.nsbutton, frame.pbutton); + XSetWindowBackgroundPixmap(display, frame.nsbutton, frame.pbutton); else - XSetWindowBackground(display, frame.nsbutton, frame.pbutton_pixel); + XSetWindowBackground(display, frame.nsbutton, frame.pbutton_pixel); } else { if (frame.button) XSetWindowBackgroundPixmap(display, frame.nsbutton, frame.button); else - XSetWindowBackground(display, frame.nsbutton, frame.button_pixel); + XSetWindowBackground(display, frame.nsbutton, frame.button_pixel); } XClearWindow(display, frame.nsbutton); } @@ -781,14 +781,14 @@ void Toolbar::redrawPrevWindowButton(Bool pressed, Bool redraw) { if (redraw) { if (pressed) { if (frame.pbutton) - XSetWindowBackgroundPixmap(display, frame.pwbutton, frame.pbutton); + XSetWindowBackgroundPixmap(display, frame.pwbutton, frame.pbutton); else - XSetWindowBackground(display, frame.pwbutton, frame.pbutton_pixel); + XSetWindowBackground(display, frame.pwbutton, frame.pbutton_pixel); } else { if (frame.button) XSetWindowBackgroundPixmap(display, frame.pwbutton, frame.button); else - XSetWindowBackground(display, frame.pwbutton, frame.button_pixel); + XSetWindowBackground(display, frame.pwbutton, frame.button_pixel); } XClearWindow(display, frame.pwbutton); } @@ -809,14 +809,14 @@ void Toolbar::redrawNextWindowButton(Bool pressed, Bool redraw) { if (redraw) { if (pressed) { if (frame.pbutton) - XSetWindowBackgroundPixmap(display, frame.nwbutton, frame.pbutton); + XSetWindowBackgroundPixmap(display, frame.nwbutton, frame.pbutton); else - XSetWindowBackground(display, frame.nwbutton, frame.pbutton_pixel); + XSetWindowBackground(display, frame.nwbutton, frame.pbutton_pixel); } else { if (frame.button) XSetWindowBackgroundPixmap(display, frame.nwbutton, frame.button); else - XSetWindowBackground(display, frame.nwbutton, frame.button_pixel); + XSetWindowBackground(display, frame.nwbutton, frame.button_pixel); } XClearWindow(display, frame.nwbutton); } @@ -1019,15 +1019,15 @@ void Toolbar::keyPressEvent(XKeyEvent *ke) { // workspace name which causes serious problems, especially for the // Blackbox::LoadRC() method. if (*new_workspace_name) { - screen->getCurrentWorkspace()->setName(new_workspace_name); - screen->getCurrentWorkspace()->getMenu()->hide(); - screen->getWorkspacemenu()-> - remove(screen->getCurrentWorkspace()->getWorkspaceID() + 2); - screen->getWorkspacemenu()-> - insert(screen->getCurrentWorkspace()->getName(), - screen->getCurrentWorkspace()->getMenu(), - screen->getCurrentWorkspace()->getWorkspaceID() + 2); - screen->getWorkspacemenu()->update(); + screen->getCurrentWorkspace()->setName(new_workspace_name); + screen->getCurrentWorkspace()->getMenu()->hide(); + screen->getWorkspacemenu()-> + remove(screen->getCurrentWorkspace()->getWorkspaceID() + 2); + screen->getWorkspacemenu()-> + insert(screen->getCurrentWorkspace()->getName(), + screen->getCurrentWorkspace()->getMenu(), + screen->getCurrentWorkspace()->getWorkspaceID() + 2); + screen->getWorkspacemenu()->update(); } delete [] new_workspace_name; @@ -1036,36 +1036,36 @@ void Toolbar::keyPressEvent(XKeyEvent *ke) { reconfigure(); } else if (! (ks == XK_Shift_L || ks == XK_Shift_R || - ks == XK_Control_L || ks == XK_Control_R || - ks == XK_Caps_Lock || ks == XK_Shift_Lock || - ks == XK_Meta_L || ks == XK_Meta_R || - ks == XK_Alt_L || ks == XK_Alt_R || - ks == XK_Super_L || ks == XK_Super_R || - ks == XK_Hyper_L || ks == XK_Hyper_R)) { + ks == XK_Control_L || ks == XK_Control_R || + ks == XK_Caps_Lock || ks == XK_Shift_Lock || + ks == XK_Meta_L || ks == XK_Meta_R || + ks == XK_Alt_L || ks == XK_Alt_R || + ks == XK_Super_L || ks == XK_Super_R || + ks == XK_Hyper_L || ks == XK_Hyper_R)) { if (ks == XK_BackSpace) { - if (new_name_pos > 0) { - --new_name_pos; - *(new_workspace_name + new_name_pos) = '\0'; - } else { - *new_workspace_name = '\0'; - } + if (new_name_pos > 0) { + --new_name_pos; + *(new_workspace_name + new_name_pos) = '\0'; + } else { + *new_workspace_name = '\0'; + } } else { - *(new_workspace_name + new_name_pos) = *keychar; - ++new_name_pos; - *(new_workspace_name + new_name_pos) = '\0'; + *(new_workspace_name + new_name_pos) = *keychar; + ++new_name_pos; + *(new_workspace_name + new_name_pos) = '\0'; } XClearWindow(display, frame.workspace_label); int l = strlen(new_workspace_name), tw, x; if (i18n.multibyte()) { - XRectangle ink, logical; - XmbTextExtents(screen->getToolbarStyle()->fontset, - new_workspace_name, l, &ink, &logical); - tw = logical.width; + XRectangle ink, logical; + XmbTextExtents(screen->getToolbarStyle()->fontset, + new_workspace_name, l, &ink, &logical); + tw = logical.width; } else { - tw = XTextWidth(screen->getToolbarStyle()->font, - new_workspace_name, l); + tw = XTextWidth(screen->getToolbarStyle()->font, + new_workspace_name, l); } x = (frame.workspace_label_w - tw) / 2; @@ -1073,18 +1073,18 @@ void Toolbar::keyPressEvent(XKeyEvent *ke) { WindowStyle *style = screen->getWindowStyle(); if (i18n.multibyte()) - XmbDrawString(display, frame.workspace_label, style->fontset, - style->l_text_focus_gc, x, - (1 - style->fontset_extents->max_ink_extent.y), - new_workspace_name, l); + XmbDrawString(display, frame.workspace_label, style->fontset, + style->l_text_focus_gc, x, + (1 - style->fontset_extents->max_ink_extent.y), + new_workspace_name, l); else - XDrawString(display, frame.workspace_label, style->l_text_focus_gc, x, - (style->font->ascent + 1), - new_workspace_name, l); + XDrawString(display, frame.workspace_label, style->l_text_focus_gc, x, + (style->font->ascent + 1), + new_workspace_name, l); XDrawRectangle(display, frame.workspace_label, - screen->getWindowStyle()->l_text_focus_gc, x + tw, 0, 1, - frame.label_h - 1); + screen->getWindowStyle()->l_text_focus_gc, x + tw, 0, 1, + frame.label_h - 1); } } } @@ -1103,10 +1103,10 @@ void Toolbar::HideHandler::timeout(void) { toolbar->hidden = ! toolbar->hidden; if (toolbar->hidden) XMoveWindow(toolbar->display, toolbar->frame.window, - toolbar->frame.x_hidden, toolbar->frame.y_hidden); + toolbar->frame.x_hidden, toolbar->frame.y_hidden); else XMoveWindow(toolbar->display, toolbar->frame.window, - toolbar->frame.x, toolbar->frame.y); + toolbar->frame.x, toolbar->frame.y); } @@ -1119,11 +1119,11 @@ Toolbarmenu::Toolbarmenu(Toolbar *tb) : Basemenu(tb->screen) { placementmenu = new Placementmenu(this); insert(i18n(CommonSet, CommonPlacementTitle, "Placement"), - placementmenu); + placementmenu); insert(i18n(CommonSet, CommonAlwaysOnTop, "Always on top"), 1); insert(i18n(CommonSet, CommonAutoHide, "Auto hide"), 2); insert(i18n(ToolbarSet, ToolbarEditWkspcName, - "Edit current workspace name"), 3); + "Edit current workspace name"), 3); update(); @@ -1194,22 +1194,22 @@ Toolbarmenu::Placementmenu::Placementmenu(Toolbarmenu *tm) toolbarmenu = tm; setLabel(i18n(ToolbarSet, ToolbarToolbarPlacement, - "Toolbar Placement")); + "Toolbar Placement")); setInternalMenu(); setMinimumSublevels(3); insert(i18n(CommonSet, CommonPlacementTopLeft, - "Top Left"), Toolbar::TopLeft); + "Top Left"), Toolbar::TopLeft); insert(i18n(CommonSet, CommonPlacementBottomLeft, - "Bottom Left"), Toolbar::BottomLeft); + "Bottom Left"), Toolbar::BottomLeft); insert(i18n(CommonSet, CommonPlacementTopCenter, - "Top Center"), Toolbar::TopCenter); + "Top Center"), Toolbar::TopCenter); insert(i18n(CommonSet, CommonPlacementBottomCenter, - "Bottom Center"), Toolbar::BottomCenter); + "Bottom Center"), Toolbar::BottomCenter); insert(i18n(CommonSet, CommonPlacementTopRight, - "Top Right"), Toolbar::TopRight); + "Top Right"), Toolbar::TopRight); insert(i18n(CommonSet, CommonPlacementBottomRight, - "Bottom Right"), Toolbar::BottomRight); + "Bottom Right"), Toolbar::BottomRight); update(); } diff --git a/src/Window.cc b/src/Window.cc index 99a50436..2dbb0d7e 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -59,7 +59,7 @@ BlackboxWindow::BlackboxWindow(Blackbox *b, Window w, BScreen *s) { fprintf(stderr, i18n(WindowSet, WindowCreating, "BlackboxWindow::BlackboxWindow(): creating 0x%lx\n"), - w); + w); #endif // DEBUG client.window = w; @@ -74,9 +74,9 @@ BlackboxWindow::BlackboxWindow(Blackbox *b, Window w, BScreen *s) { (! wattrib.screen) || wattrib.override_redirect) { #ifdef DEBUG fprintf(stderr, - i18n(WindowSet, WindowXGetWindowAttributesFail, - "BlackboxWindow::BlackboxWindow(): XGetWindowAttributes " - "failed\n")); + i18n(WindowSet, WindowXGetWindowAttributesFail, + "BlackboxWindow::BlackboxWindow(): XGetWindowAttributes " + "failed\n")); #endif // DEBUG return; @@ -219,16 +219,16 @@ BlackboxWindow::BlackboxWindow(Blackbox *b, Window w, BScreen *s) { setGravityOffsets(); if ((blackbox->isStartup()) || - (frame.x >= 0 && - (signed) (frame.y + frame.y_border) >= 0 && - frame.x <= (signed) screen->getWidth() && - frame.y <= (signed) screen->getHeight())) + (frame.x >= 0 && + (signed) (frame.y + frame.y_border) >= 0 && + frame.x <= (signed) screen->getWidth() && + frame.y <= (signed) screen->getHeight())) place_window = False; } frame.window = createToplevelWindow(frame.x, frame.y, frame.width, - frame.height, - frame.border_w); + frame.height, + frame.border_w); blackbox->saveWindowSearch(frame.window, this); frame.plate = createChildWindow(frame.window); @@ -425,8 +425,8 @@ BlackboxWindow::~BlackboxWindow(void) { * Returns: the newly created window */ Window BlackboxWindow::createToplevelWindow(int x, int y, unsigned int width, - unsigned int height, - unsigned int borderwidth) { + unsigned int height, + unsigned int borderwidth) { XSetWindowAttributes attrib_create; unsigned long create_mask = CWBackPixmap | CWBorderPixel | CWColormap | CWOverrideRedirect | CWEventMask; @@ -438,9 +438,9 @@ Window BlackboxWindow::createToplevelWindow(int x, int y, unsigned int width, ButtonMotionMask | EnterWindowMask; return XCreateWindow(display, screen->getRootWindow(), x, y, width, height, - borderwidth, screen->getDepth(), InputOutput, - screen->getVisual(), create_mask, - &attrib_create); + borderwidth, screen->getDepth(), InputOutput, + screen->getVisual(), create_mask, + &attrib_create); } @@ -464,8 +464,8 @@ Window BlackboxWindow::createChildWindow(Window parent, Cursor cursor) { } return XCreateWindow(display, parent, 0, 0, 1, 1, 0, screen->getDepth(), - InputOutput, screen->getVisual(), create_mask, - &attrib_create); + InputOutput, screen->getVisual(), create_mask, + &attrib_create); } @@ -499,13 +499,13 @@ void BlackboxWindow::associateClientWindow(void) { unsigned int ufoo; XShapeQueryExtents(display, client.window, &flags.shaped, &foo, &foo, - &ufoo, &ufoo, &foo, &foo, &foo, &ufoo, &ufoo); + &ufoo, &ufoo, &foo, &foo, &foo, &ufoo, &ufoo); if (flags.shaped) { XShapeCombineShape(display, frame.window, ShapeBounding, - frame.mwm_border_w, frame.y_border + - frame.mwm_border_w, client.window, - ShapeBounding, ShapeSet); + frame.mwm_border_w, frame.y_border + + frame.mwm_border_w, client.window, + ShapeBounding, ShapeSet); int num = 1; XRectangle xrect[2]; @@ -514,15 +514,15 @@ void BlackboxWindow::associateClientWindow(void) { xrect[0].height = frame.y_border; if (decorations.handle) { - xrect[1].x = 0; - xrect[1].y = frame.y_handle; - xrect[1].width = frame.width; - xrect[1].height = frame.handle_h + frame.border_w; - num++; + xrect[1].x = 0; + xrect[1].y = frame.y_handle; + xrect[1].width = frame.width; + xrect[1].height = frame.handle_h + frame.border_w; + num++; } XShapeCombineRectangles(display, frame.window, ShapeBounding, 0, 0, - xrect, num, ShapeUnion, Unsorted); + xrect, num, ShapeUnion, Unsorted); } } #endif // SHAPE @@ -536,7 +536,7 @@ void BlackboxWindow::associateClientWindow(void) { XSetWindowBackgroundPixmap(display, frame.close_button, frame.ubutton); if (frame.maximize_button) XSetWindowBackgroundPixmap(display, frame.maximize_button, - frame.ubutton); + frame.ubutton); if (frame.iconify_button) XSetWindowBackgroundPixmap(display, frame.iconify_button,frame.ubutton); } else { @@ -544,7 +544,7 @@ void BlackboxWindow::associateClientWindow(void) { XSetWindowBackground(display, frame.close_button, frame.ubutton_pixel); if (frame.maximize_button) XSetWindowBackground(display, frame.maximize_button, - frame.ubutton_pixel); + frame.ubutton_pixel); if (frame.iconify_button) XSetWindowBackground(display, frame.iconify_button,frame.ubutton_pixel); } @@ -737,7 +737,7 @@ void BlackboxWindow::positionButtons(Bool redecorate_label) { if (decorations.iconify && frame.iconify_button != None) { XMoveResizeWindow(display, frame.iconify_button, by, by, - frame.button_w, frame.button_h); + frame.button_w, frame.button_h); XMapWindow(display, frame.iconify_button); XClearWindow(display, frame.iconify_button); @@ -750,7 +750,7 @@ void BlackboxWindow::positionButtons(Bool redecorate_label) { if (decorations.close && frame.close_button != None) { XMoveResizeWindow(display, frame.close_button, bx, by, - frame.button_w, frame.button_h); + frame.button_w, frame.button_h); XMapWindow(display, frame.close_button); XClearWindow(display, frame.close_button); @@ -761,7 +761,7 @@ void BlackboxWindow::positionButtons(Bool redecorate_label) { } if (decorations.maximize && frame.maximize_button != None) { XMoveResizeWindow(display, frame.maximize_button, bx, by, - frame.button_w, frame.button_h); + frame.button_w, frame.button_h); XMapWindow(display, frame.maximize_button); XClearWindow(display, frame.maximize_button); @@ -784,17 +784,17 @@ void BlackboxWindow::reconfigure(void) { client.x = frame.x + frame.mwm_border_w + frame.border_w; client.y = frame.y + frame.y_border + frame.mwm_border_w + - frame.border_w; + frame.border_w; if (client.title) { if (i18n.multibyte()) { XRectangle ink, logical; XmbTextExtents(screen->getWindowStyle()->fontset, - client.title, client.title_len, &ink, &logical); + client.title, client.title_len, &ink, &logical); client.title_text_w = logical.width; } else { client.title_text_w = XTextWidth(screen->getWindowStyle()->font, - client.title, client.title_len); + client.title, client.title_len); } client.title_text_w += (frame.bevel_w * 4); } @@ -833,7 +833,7 @@ void BlackboxWindow::positionWindows(void) { if (decorations.titlebar) { XSetWindowBorderWidth(display, frame.title, frame.border_w); XMoveResizeWindow(display, frame.title, -frame.border_w, - -frame.border_w, frame.width, frame.title_h); + -frame.border_w, frame.width, frame.title_h); positionButtons(); } else if (frame.title) { @@ -846,11 +846,11 @@ void BlackboxWindow::positionWindows(void) { XMoveResizeWindow(display, frame.handle, -frame.border_w, frame.y_handle - frame.border_w, - frame.width, frame.handle_h); + frame.width, frame.handle_h); XMoveResizeWindow(display, frame.left_grip, -frame.border_w, - -frame.border_w, frame.grip_w, frame.grip_h); + -frame.border_w, frame.grip_w, frame.grip_h); XMoveResizeWindow(display, frame.right_grip, - frame.width - frame.grip_w - frame.border_w, + frame.width - frame.grip_w - frame.border_w, -frame.border_w, frame.grip_w, frame.grip_h); XMapSubwindows(display, frame.handle); } else if (frame.handle) { @@ -872,39 +872,39 @@ void BlackboxWindow::getWMName(void) { if (XGetWMName(display, client.window, &text_prop)) { if (text_prop.value && text_prop.nitems > 0) { if (text_prop.encoding != XA_STRING) { - text_prop.nitems = strlen((char *) text_prop.value); - - if ((XmbTextPropertyToTextList(display, &text_prop, - &list, &num) == Success) && - (num > 0) && *list) { - client.title = bstrdup(*list); - XFreeStringList(list); - } else { - client.title = bstrdup((char *) text_prop.value); - } + text_prop.nitems = strlen((char *) text_prop.value); + + if ((XmbTextPropertyToTextList(display, &text_prop, + &list, &num) == Success) && + (num > 0) && *list) { + client.title = bstrdup(*list); + XFreeStringList(list); + } else { + client.title = bstrdup((char *) text_prop.value); + } } else { - client.title = bstrdup((char *) text_prop.value); + client.title = bstrdup((char *) text_prop.value); } XFree((char *) text_prop.value); } else { client.title = bstrdup(i18n(WindowSet, WindowUnnamed, - "Unnamed")); + "Unnamed")); } } else { client.title = bstrdup(i18n(WindowSet, WindowUnnamed, - "Unnamed")); + "Unnamed")); } client.title_len = strlen(client.title); if (i18n.multibyte()) { XRectangle ink, logical; XmbTextExtents(screen->getWindowStyle()->fontset, - client.title, client.title_len, &ink, &logical); + client.title, client.title_len, &ink, &logical); client.title_text_w = logical.width; } else { client.title_len = strlen(client.title); client.title_text_w = XTextWidth(screen->getWindowStyle()->font, - client.title, client.title_len); + client.title, client.title_len); } client.title_text_w += (frame.bevel_w * 4); @@ -924,18 +924,18 @@ void BlackboxWindow::getWMIconName(void) { if (XGetWMIconName(display, client.window, &text_prop)) { if (text_prop.value && text_prop.nitems > 0) { if (text_prop.encoding != XA_STRING) { - text_prop.nitems = strlen((char *) text_prop.value); - - if ((XmbTextPropertyToTextList(display, &text_prop, - &list, &num) == Success) && - (num > 0) && *list) { - client.icon_title = bstrdup(*list); - XFreeStringList(list); - } else { - client.icon_title = bstrdup((char *) text_prop.value); - } + text_prop.nitems = strlen((char *) text_prop.value); + + if ((XmbTextPropertyToTextList(display, &text_prop, + &list, &num) == Success) && + (num > 0) && *list) { + client.icon_title = bstrdup(*list); + XFreeStringList(list); + } else { + client.icon_title = bstrdup((char *) text_prop.value); + } } else { - client.icon_title = bstrdup((char *) text_prop.value); + client.icon_title = bstrdup((char *) text_prop.value); } XFree((char *) text_prop.value); } else { @@ -961,7 +961,7 @@ void BlackboxWindow::getWMProtocols(void) { if (XGetWMProtocols(display, client.window, &proto, &num_return)) { for (int i = 0; i < num_return; ++i) { if (proto[i] == blackbox->getWMDeleteAtom()) - functions.close = decorations.close = True; + functions.close = decorations.close = True; else if (proto[i] == blackbox->getWMTakeFocusAtom()) flags.send_focus_message = True; else if (proto[i] == blackbox->getBlackboxStructureMessagesAtom()) @@ -991,14 +991,14 @@ void BlackboxWindow::getWMHints(void) { if (wmhint->flags & InputHint) { if (wmhint->input == True) { if (flags.send_focus_message) - focus_mode = F_LocallyActive; + focus_mode = F_LocallyActive; else - focus_mode = F_Passive; + focus_mode = F_Passive; } else { if (flags.send_focus_message) - focus_mode = F_GloballyActive; + focus_mode = F_GloballyActive; else - focus_mode = F_NoInput; + focus_mode = F_NoInput; } } else { focus_mode = F_Passive; @@ -1090,11 +1090,11 @@ void BlackboxWindow::getMWMHints(void) { unsigned long num, len; int ret = XGetWindowProperty(display, client.window, - blackbox->getMotifWMHintsAtom(), 0, - PropMwmHintsElements, False, - blackbox->getMotifWMHintsAtom(), &atom_return, - &format, &num, &len, - (unsigned char **) &client.mwm_hint); + blackbox->getMotifWMHintsAtom(), 0, + PropMwmHintsElements, False, + blackbox->getMotifWMHintsAtom(), &atom_return, + &format, &num, &len, + (unsigned char **) &client.mwm_hint); if (ret != Success || !client.mwm_hint || num != PropMwmHintsElements) return; @@ -1102,46 +1102,46 @@ void BlackboxWindow::getMWMHints(void) { if (client.mwm_hint->flags & MwmHintsDecorations) { if (client.mwm_hint->decorations & MwmDecorAll) { decorations.titlebar = decorations.handle = decorations.border = - decorations.iconify = decorations.maximize = - decorations.close = decorations.menu = True; + decorations.iconify = decorations.maximize = + decorations.close = decorations.menu = True; } else { decorations.titlebar = decorations.handle = decorations.border = - decorations.iconify = decorations.maximize = - decorations.close = decorations.menu = False; + decorations.iconify = decorations.maximize = + decorations.close = decorations.menu = False; if (client.mwm_hint->decorations & MwmDecorBorder) - decorations.border = True; + decorations.border = True; if (client.mwm_hint->decorations & MwmDecorHandle) - decorations.handle = True; + decorations.handle = True; if (client.mwm_hint->decorations & MwmDecorTitle) - decorations.titlebar = True; + decorations.titlebar = True; if (client.mwm_hint->decorations & MwmDecorMenu) - decorations.menu = True; + decorations.menu = True; if (client.mwm_hint->decorations & MwmDecorIconify) - decorations.iconify = True; + decorations.iconify = True; if (client.mwm_hint->decorations & MwmDecorMaximize) - decorations.maximize = True; + decorations.maximize = True; } } if (client.mwm_hint->flags & MwmHintsFunctions) { if (client.mwm_hint->functions & MwmFuncAll) { functions.resize = functions.move = functions.iconify = - functions.maximize = functions.close = True; + functions.maximize = functions.close = True; } else { functions.resize = functions.move = functions.iconify = - functions.maximize = functions.close = False; + functions.maximize = functions.close = False; if (client.mwm_hint->functions & MwmFuncResize) - functions.resize = True; + functions.resize = True; if (client.mwm_hint->functions & MwmFuncMove) - functions.move = True; + functions.move = True; if (client.mwm_hint->functions & MwmFuncIconify) - functions.iconify = True; + functions.iconify = True; if (client.mwm_hint->functions & MwmFuncMaximize) - functions.maximize = True; + functions.maximize = True; if (client.mwm_hint->functions & MwmFuncClose) - functions.close = True; + functions.close = True; } } } @@ -1160,11 +1160,11 @@ void BlackboxWindow::getBlackboxHints(void) { unsigned long num, len; int ret = XGetWindowProperty(display, client.window, - blackbox->getBlackboxHintsAtom(), 0, - PropBlackboxHintsElements, False, - blackbox->getBlackboxHintsAtom(), &atom_return, - &format, &num, &len, - (unsigned char **) &client.blackbox_hint); + blackbox->getBlackboxHintsAtom(), 0, + PropBlackboxHintsElements, False, + blackbox->getBlackboxHintsAtom(), &atom_return, + &format, &num, &len, + (unsigned char **) &client.blackbox_hint); if (ret != Success || !client.blackbox_hint || num != PropBlackboxHintsElements) return; @@ -1175,7 +1175,7 @@ void BlackboxWindow::getBlackboxHints(void) { if ((client.blackbox_hint->flags & AttribMaxHoriz) && (client.blackbox_hint->flags & AttribMaxVert)) flags.maximized = (client.blackbox_hint->attrib & - (AttribMaxHoriz | AttribMaxVert)) ? 1 : 0; + (AttribMaxHoriz | AttribMaxVert)) ? 1 : 0; else if (client.blackbox_hint->flags & AttribMaxVert) flags.maximized = (client.blackbox_hint->attrib & AttribMaxVert) ? 2 : 0; else if (client.blackbox_hint->flags & AttribMaxHoriz) @@ -1195,36 +1195,36 @@ void BlackboxWindow::getBlackboxHints(void) { switch (client.blackbox_hint->decoration) { case DecorNone: decorations.titlebar = decorations.border = decorations.handle = - decorations.iconify = decorations.maximize = - decorations.menu = False; + decorations.iconify = decorations.maximize = + decorations.menu = False; functions.resize = functions.move = functions.iconify = - functions.maximize = False; + functions.maximize = False; break; case DecorTiny: decorations.titlebar = decorations.iconify = decorations.menu = - functions.move = functions.iconify = True; + functions.move = functions.iconify = True; decorations.border = decorations.handle = decorations.maximize = - functions.resize = functions.maximize = False; + functions.resize = functions.maximize = False; break; case DecorTool: decorations.titlebar = decorations.menu = functions.move = True; decorations.iconify = decorations.border = decorations.handle = - decorations.maximize = functions.resize = functions.maximize = - functions.iconify = False; + decorations.maximize = functions.resize = functions.maximize = + functions.iconify = False; break; case DecorNormal: default: decorations.titlebar = decorations.border = decorations.handle = - decorations.iconify = decorations.maximize = - decorations.menu = True; + decorations.iconify = decorations.maximize = + decorations.menu = True; functions.resize = functions.move = functions.iconify = - functions.maximize = True; + functions.maximize = True; break; } @@ -1252,9 +1252,9 @@ void BlackboxWindow::configure(int dx, int dy, #ifdef SHAPE if (blackbox->hasShapeExtensions() && flags.shaped) { XShapeCombineShape(display, frame.window, ShapeBounding, - frame.mwm_border_w, frame.y_border + - frame.mwm_border_w, client.window, - ShapeBounding, ShapeSet); + frame.mwm_border_w, frame.y_border + + frame.mwm_border_w, client.window, + ShapeBounding, ShapeSet); int num = 1; XRectangle xrect[2]; @@ -1263,15 +1263,15 @@ void BlackboxWindow::configure(int dx, int dy, xrect[0].height = frame.y_border; if (decorations.handle) { - xrect[1].x = 0; - xrect[1].y = frame.y_handle; - xrect[1].width = frame.width; - xrect[1].height = frame.handle_h + frame.border_w; - num++; + xrect[1].x = 0; + xrect[1].y = frame.y_handle; + xrect[1].width = frame.width; + xrect[1].height = frame.handle_h + frame.border_w; + num++; } XShapeCombineRectangles(display, frame.window, ShapeBounding, 0, 0, - xrect, num, ShapeUnion, Unsorted); + xrect, num, ShapeUnion, Unsorted); } #endif // SHAPE @@ -1332,7 +1332,7 @@ Bool BlackboxWindow::setInputFocus(void) { frame.width, frame.height); else if (frame.y > (signed) screen->getHeight()) configure(screen->getWidth() - frame.width, - screen->getHeight() - frame.height, + screen->getHeight() - frame.height, frame.width, frame.height); else configure(screen->getWidth() - frame.width, @@ -1348,10 +1348,10 @@ Bool BlackboxWindow::setInputFocus(void) { } else if (! flags.focused) { if (focus_mode == F_LocallyActive || focus_mode == F_Passive) XSetInputFocus(display, client.window, - RevertToPointerRoot, CurrentTime); + RevertToPointerRoot, CurrentTime); else XSetInputFocus(display, screen->getRootWindow(), - RevertToNone, CurrentTime); + RevertToNone, CurrentTime); blackbox->setFocusedWindow(this); @@ -1487,7 +1487,7 @@ void BlackboxWindow::maximize(unsigned int button) { // so we do not need to call configure() because resizing will handle it if (!flags.resizing) configure(blackbox_attrib.premax_x, blackbox_attrib.premax_y, - blackbox_attrib.premax_w, blackbox_attrib.premax_h); + blackbox_attrib.premax_w, blackbox_attrib.premax_h); blackbox_attrib.premax_x = blackbox_attrib.premax_y = 0; blackbox_attrib.premax_w = blackbox_attrib.premax_h = 0; @@ -1708,22 +1708,22 @@ void BlackboxWindow::installColormap(Bool install) { if (cmaps) { if (XGetWindowAttributes(display, client.window, &wattrib)) { if (install) { - // install the window's colormap - for (i = 0; i < ncmap; i++) { - if (*(cmaps + i) == wattrib.colormap) - // this window is using an installed color map... do not install - install = False; - } - // otherwise, install the window's colormap - if (install) - XInstallColormap(display, wattrib.colormap); + // install the window's colormap + for (i = 0; i < ncmap; i++) { + if (*(cmaps + i) == wattrib.colormap) + // this window is using an installed color map... do not install + install = False; + } + // otherwise, install the window's colormap + if (install) + XInstallColormap(display, wattrib.colormap); } else { - // uninstall the window's colormap - for (i = 0; i < ncmap; i++) { - if (*(cmaps + i) == wattrib.colormap) - // we found the colormap to uninstall - XUninstallColormap(display, wattrib.colormap); - } + // uninstall the window's colormap + for (i = 0; i < ncmap; i++) { + if (*(cmaps + i) == wattrib.colormap) + // we found the colormap to uninstall + XUninstallColormap(display, wattrib.colormap); + } } } @@ -1739,14 +1739,14 @@ void BlackboxWindow::setState(unsigned long new_state) { state[0] = (unsigned long) current_state; state[1] = (unsigned long) None; XChangeProperty(display, client.window, blackbox->getWMStateAtom(), - blackbox->getWMStateAtom(), 32, PropModeReplace, - (unsigned char *) state, 2); + blackbox->getWMStateAtom(), 32, PropModeReplace, + (unsigned char *) state, 2); XChangeProperty(display, client.window, - blackbox->getBlackboxAttributesAtom(), + blackbox->getBlackboxAttributesAtom(), blackbox->getBlackboxAttributesAtom(), 32, PropModeReplace, (unsigned char *) &blackbox_attrib, - PropBlackboxAttributesElements); + PropBlackboxAttributesElements); } @@ -1759,9 +1759,9 @@ Bool BlackboxWindow::getState(void) { unsigned long *state, ulfoo, nitems; if ((XGetWindowProperty(display, client.window, blackbox->getWMStateAtom(), - 0l, 2l, False, blackbox->getWMStateAtom(), - &atom_return, &foo, &nitems, &ulfoo, - (unsigned char **) &state) != Success) || + 0l, 2l, False, blackbox->getWMStateAtom(), + &atom_return, &foo, &nitems, &ulfoo, + (unsigned char **) &state) != Success) || (! state)) { return False; } @@ -1844,11 +1844,11 @@ void BlackboxWindow::restoreAttributes(void) { BlackboxAttributes *net; int ret = XGetWindowProperty(display, client.window, - blackbox->getBlackboxAttributesAtom(), 0l, - PropBlackboxAttributesElements, False, - blackbox->getBlackboxAttributesAtom(), - &atom_return, &foo, &nitems, &ulfoo, - (unsigned char **) &net); + blackbox->getBlackboxAttributesAtom(), 0l, + PropBlackboxAttributesElements, False, + blackbox->getBlackboxAttributesAtom(), + &atom_return, &foo, &nitems, &ulfoo, + (unsigned char **) &net); if (ret != Success || !net || nitems != PropBlackboxAttributesElements) return; @@ -2001,17 +2001,17 @@ void BlackboxWindow::redrawLabel(void) { if (client.title_text_w > frame.label_w) { for (; dlen >= 0; dlen--) { if (i18n.multibyte()) { - XRectangle ink, logical; - XmbTextExtents(screen->getWindowStyle()->fontset, client.title, dlen, - &ink, &logical); - l = logical.width; + XRectangle ink, logical; + XmbTextExtents(screen->getWindowStyle()->fontset, client.title, dlen, + &ink, &logical); + l = logical.width; } else { - l = XTextWidth(screen->getWindowStyle()->font, client.title, dlen); + l = XTextWidth(screen->getWindowStyle()->font, client.title, dlen); } l += (frame.bevel_w * 4); if (l < frame.label_w) - break; + break; } } @@ -2030,11 +2030,11 @@ void BlackboxWindow::redrawLabel(void) { style->l_text_unfocus_gc; if (i18n.multibyte()) XmbDrawString(display, frame.label, style->fontset, text_gc, dx, - (1 - style->fontset_extents->max_ink_extent.y), - client.title, dlen); + (1 - style->fontset_extents->max_ink_extent.y), + client.title, dlen); else XDrawString(display, frame.label, text_gc, dx, - (style->font->ascent + 1), client.title, dlen); + (style->font->ascent + 1), client.title, dlen); } @@ -2050,17 +2050,17 @@ void BlackboxWindow::redrawIconifyButton(Bool pressed) { if (flags.focused) { if (frame.fbutton) XSetWindowBackgroundPixmap(display, frame.iconify_button, - frame.fbutton); + frame.fbutton); else XSetWindowBackground(display, frame.iconify_button, - frame.fbutton_pixel); + frame.fbutton_pixel); } else { if (frame.ubutton) XSetWindowBackgroundPixmap(display, frame.iconify_button, - frame.ubutton); + frame.ubutton); else XSetWindowBackground(display, frame.iconify_button, - frame.ubutton_pixel); + frame.ubutton_pixel); } } else { if (frame.pbutton) @@ -2071,9 +2071,9 @@ void BlackboxWindow::redrawIconifyButton(Bool pressed) { XClearWindow(display, frame.iconify_button); XDrawRectangle(display, frame.iconify_button, - ((flags.focused) ? screen->getWindowStyle()->b_pic_focus_gc : - screen->getWindowStyle()->b_pic_unfocus_gc), - 2, (frame.button_h - 5), (frame.button_w - 5), 2); + ((flags.focused) ? screen->getWindowStyle()->b_pic_focus_gc : + screen->getWindowStyle()->b_pic_unfocus_gc), + 2, (frame.button_h - 5), (frame.button_w - 5), 2); } @@ -2082,36 +2082,36 @@ void BlackboxWindow::redrawMaximizeButton(Bool pressed) { if (flags.focused) { if (frame.fbutton) XSetWindowBackgroundPixmap(display, frame.maximize_button, - frame.fbutton); + frame.fbutton); else XSetWindowBackground(display, frame.maximize_button, - frame.fbutton_pixel); + frame.fbutton_pixel); } else { if (frame.ubutton) XSetWindowBackgroundPixmap(display, frame.maximize_button, - frame.ubutton); + frame.ubutton); else XSetWindowBackground(display, frame.maximize_button, - frame.ubutton_pixel); + frame.ubutton_pixel); } } else { if (frame.pbutton) XSetWindowBackgroundPixmap(display, frame.maximize_button, - frame.pbutton); + frame.pbutton); else XSetWindowBackground(display, frame.maximize_button, - frame.pbutton_pixel); + frame.pbutton_pixel); } XClearWindow(display, frame.maximize_button); XDrawRectangle(display, frame.maximize_button, - ((flags.focused) ? screen->getWindowStyle()->b_pic_focus_gc : - screen->getWindowStyle()->b_pic_unfocus_gc), - 2, 2, (frame.button_w - 5), (frame.button_h - 5)); + ((flags.focused) ? screen->getWindowStyle()->b_pic_focus_gc : + screen->getWindowStyle()->b_pic_unfocus_gc), + 2, 2, (frame.button_w - 5), (frame.button_h - 5)); XDrawLine(display, frame.maximize_button, - ((flags.focused) ? screen->getWindowStyle()->b_pic_focus_gc : - screen->getWindowStyle()->b_pic_unfocus_gc), - 2, 3, (frame.button_w - 3), 3); + ((flags.focused) ? screen->getWindowStyle()->b_pic_focus_gc : + screen->getWindowStyle()->b_pic_unfocus_gc), + 2, 3, (frame.button_w - 3), 3); } @@ -2120,17 +2120,17 @@ void BlackboxWindow::redrawCloseButton(Bool pressed) { if (flags.focused) { if (frame.fbutton) XSetWindowBackgroundPixmap(display, frame.close_button, - frame.fbutton); + frame.fbutton); else XSetWindowBackground(display, frame.close_button, - frame.fbutton_pixel); + frame.fbutton_pixel); } else { if (frame.ubutton) XSetWindowBackgroundPixmap(display, frame.close_button, - frame.ubutton); + frame.ubutton); else XSetWindowBackground(display, frame.close_button, - frame.ubutton_pixel); + frame.ubutton_pixel); } } else { if (frame.pbutton) @@ -2141,13 +2141,13 @@ void BlackboxWindow::redrawCloseButton(Bool pressed) { XClearWindow(display, frame.close_button); XDrawLine(display, frame.close_button, - ((flags.focused) ? screen->getWindowStyle()->b_pic_focus_gc : - screen->getWindowStyle()->b_pic_unfocus_gc), 2, 2, + ((flags.focused) ? screen->getWindowStyle()->b_pic_focus_gc : + screen->getWindowStyle()->b_pic_unfocus_gc), 2, 2, (frame.button_w - 3), (frame.button_h - 3)); XDrawLine(display, frame.close_button, - ((flags.focused) ? screen->getWindowStyle()->b_pic_focus_gc : - screen->getWindowStyle()->b_pic_unfocus_gc), 2, - (frame.button_h - 3), + ((flags.focused) ? screen->getWindowStyle()->b_pic_focus_gc : + screen->getWindowStyle()->b_pic_unfocus_gc), 2, + (frame.button_h - 3), (frame.button_w - 3), 2); } @@ -2156,7 +2156,7 @@ void BlackboxWindow::mapRequestEvent(XMapRequestEvent *re) { if (re->window == client.window) { #ifdef DEBUG fprintf(stderr, i18n(WindowSet, WindowMapRequest, - "BlackboxWindow::mapRequestEvent() for 0x%lx\n"), + "BlackboxWindow::mapRequestEvent() for 0x%lx\n"), client.window); #endif // DEBUG @@ -2230,7 +2230,7 @@ void BlackboxWindow::unmapNotifyEvent(XUnmapEvent *ue) { XDeleteProperty(display, client.window, blackbox->getWMStateAtom()); XDeleteProperty(display, client.window, - blackbox->getBlackboxAttributesAtom()); + blackbox->getBlackboxAttributesAtom()); XUnmapWindow(display, frame.window); XUnmapWindow(display, client.window); @@ -2268,9 +2268,9 @@ void BlackboxWindow::reparentNotifyEvent(XReparentEvent *re) { #ifdef DEBUG fprintf(stderr, - i18n(WindowSet, WindowReparentNotify, - "BlackboxWindow::reparentNotifyEvent(): reparent 0x%lx to " - "0x%lx.\n"), client.window, re->parent); + i18n(WindowSet, WindowReparentNotify, + "BlackboxWindow::reparentNotifyEvent(): reparent 0x%lx to " + "0x%lx.\n"), client.window, re->parent); #endif // DEBUG restoreGravity(); @@ -2353,10 +2353,10 @@ void BlackboxWindow::propertyNotifyEvent(Atom atom) { if (client.max_width <= client.min_width && client.max_height <= client.min_height) decorations.maximize = decorations.handle = - functions.resize = functions.maximize = False; + functions.resize = functions.maximize = False; else decorations.maximize = decorations.handle = - functions.resize = functions.maximize = True; + functions.resize = functions.maximize = True; } int x = frame.x, y = frame.y; @@ -2432,15 +2432,15 @@ void BlackboxWindow::configureRequestEvent(XConfigureRequestEvent *cr) { case Above: case TopIf: default: - if (flags.iconic) deiconify(); - screen->getWorkspace(workspace_number)->raiseWindow(this); - break; + if (flags.iconic) deiconify(); + screen->getWorkspace(workspace_number)->raiseWindow(this); + break; case Below: case BottomIf: - if (flags.iconic) deiconify(); - screen->getWorkspace(workspace_number)->lowerWindow(this); - break; + if (flags.iconic) deiconify(); + screen->getWorkspace(workspace_number)->lowerWindow(this); + break; } } } @@ -2462,7 +2462,7 @@ void BlackboxWindow::buttonPressEvent(XButtonEvent *be) { redrawCloseButton(True); } else if (frame.plate == be->window) { if ((! flags.focused) && (! screen->isSloppyFocus())) - setInputFocus(); + setInputFocus(); if (windowmenu && windowmenu->isVisible()) windowmenu->hide(); @@ -2471,14 +2471,14 @@ void BlackboxWindow::buttonPressEvent(XButtonEvent *be) { XAllowEvents(display, ReplayPointer, be->time); } else { if (frame.title == be->window || frame.label == be->window) { - if (((be->time - lastButtonPressTime) <= - blackbox->getDoubleClickInterval()) || + if (((be->time - lastButtonPressTime) <= + blackbox->getDoubleClickInterval()) || (be->state & ControlMask)) { - lastButtonPressTime = 0; - shade(); - } else { - lastButtonPressTime = be->time; - } + lastButtonPressTime = 0; + shade(); + } else { + lastButtonPressTime = be->time; + } } frame.grab_x = be->x_root - frame.x - frame.border_w; @@ -2489,11 +2489,11 @@ void BlackboxWindow::buttonPressEvent(XButtonEvent *be) { screen->getWorkspace(workspace_number)->raiseWindow(this); } } else if (be->button == 2 && (be->window != frame.iconify_button) && - (be->window != frame.close_button)) { + (be->window != frame.close_button)) { screen->getWorkspace(workspace_number)->lowerWindow(this); } else if (windowmenu && be->button == 3 && - (frame.title == be->window || frame.label == be->window || - frame.handle == be->window || frame.window == be->window)) { + (frame.title == be->window || frame.label == be->window || + frame.handle == be->window || frame.window == be->window)) { int mx = 0, my = 0; if (frame.title == be->window || frame.label == be->window) { @@ -2506,9 +2506,9 @@ void BlackboxWindow::buttonPressEvent(XButtonEvent *be) { mx = be->x_root - (windowmenu->getWidth() / 2); if (be->y <= (signed) frame.bevel_w) - my = frame.y + frame.y_border; + my = frame.y + frame.y_border; else - my = be->y_root - (windowmenu->getHeight() / 2); + my = be->y_root - (windowmenu->getHeight() / 2); } if (mx > (signed) (frame.x + frame.width - windowmenu->getWidth())) @@ -2519,18 +2519,18 @@ void BlackboxWindow::buttonPressEvent(XButtonEvent *be) { if (my > (signed) (frame.y + frame.y_handle - windowmenu->getHeight())) my = frame.y + frame.y_handle - windowmenu->getHeight(); if (my < (signed) (frame.y + ((decorations.titlebar) ? frame.title_h : - frame.y_border))) + frame.y_border))) my = frame.y + - ((decorations.titlebar) ? frame.title_h : frame.y_border); + ((decorations.titlebar) ? frame.title_h : frame.y_border); if (windowmenu) { if (! windowmenu->isVisible()) { - windowmenu->move(mx, my); - windowmenu->show(); + windowmenu->move(mx, my); + windowmenu->show(); XRaiseWindow(display, windowmenu->getWindowID()); XRaiseWindow(display, windowmenu->getSendToMenu()->getWindowID()); } else { - windowmenu->hide(); + windowmenu->hide(); } } } @@ -2549,14 +2549,14 @@ void BlackboxWindow::buttonReleaseEvent(XButtonEvent *re) { } } else if (re->window == frame.iconify_button) { if ((re->x >= 0) && ((unsigned) re->x <= frame.button_w) && - (re->y >= 0) && ((unsigned) re->y <= frame.button_h)) { + (re->y >= 0) && ((unsigned) re->y <= frame.button_h)) { iconify(); } else { redrawIconifyButton(False); } } else if (re->window == frame.close_button) { if ((re->x >= 0) && ((unsigned) re->x <= frame.button_w) && - (re->y >= 0) && ((unsigned) re->y <= frame.button_h)) + (re->y >= 0) && ((unsigned) re->y <= frame.button_h)) close(); redrawCloseButton(False); } else if (flags.moving) { @@ -2566,8 +2566,8 @@ void BlackboxWindow::buttonReleaseEvent(XButtonEvent *re) { if (! screen->doOpaqueMove()) { XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), - frame.move_x, frame.move_y, frame.resize_w, - frame.resize_h); + frame.move_x, frame.move_y, frame.resize_w, + frame.resize_h); XUngrabServer( display ); configure(frame.move_x, frame.move_y, frame.width, frame.height); @@ -2578,8 +2578,8 @@ void BlackboxWindow::buttonReleaseEvent(XButtonEvent *re) { XUngrabPointer(display, CurrentTime); } else if (flags.resizing) { XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), - frame.resize_x, frame.resize_y, - frame.resize_w, frame.resize_h); + frame.resize_x, frame.resize_y, + frame.resize_w, frame.resize_h); XUngrabServer( display ); screen->hideGeometry(); @@ -2594,8 +2594,8 @@ void BlackboxWindow::buttonReleaseEvent(XButtonEvent *re) { maximize(0); flags.resizing = False; configure(frame.resize_x, frame.resize_y, - frame.resize_w - (frame.border_w * 2), - frame.resize_h - (frame.border_w * 2)); + frame.resize_w - (frame.border_w * 2), + frame.resize_h - (frame.border_w * 2)); XUngrabPointer(display, CurrentTime); } else if (re->window == frame.window) { @@ -2625,16 +2625,16 @@ void BlackboxWindow::motionNotifyEvent(XMotionEvent *me) { XGrabServer( display ); frame.move_x = frame.x; - frame.move_y = frame.y; + frame.move_y = frame.y; frame.resize_w = frame.width + (frame.border_w * 2); frame.resize_h = ((flags.shaded) ? frame.title_h : frame.height) + (frame.border_w * 2); - screen->showPosition(frame.x, frame.y); + screen->showPosition(frame.x, frame.y); - XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), - frame.move_x, frame.move_y, - frame.resize_w, frame.resize_h); + XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), + frame.move_x, frame.move_y, + frame.resize_w, frame.resize_h); } } else { int dx = me->x_root - frame.grab_x, dy = me->y_root - frame.grab_y; @@ -2646,8 +2646,8 @@ void BlackboxWindow::motionNotifyEvent(XMotionEvent *me) { int drx = screen->getWidth() - (dx + frame.snap_w); if (dx > 0 && dx < drx && dx < screen->getEdgeSnapThreshold()) dx = 0; - else if (drx > 0 && drx < screen->getEdgeSnapThreshold()) - dx = screen->getWidth() - frame.snap_w; + else if (drx > 0 && drx < screen->getEdgeSnapThreshold()) + dx = screen->getWidth() - frame.snap_w; int dtty, dbby, dty, dby; switch (screen->getToolbarPlacement()) { @@ -2655,47 +2655,47 @@ void BlackboxWindow::motionNotifyEvent(XMotionEvent *me) { case Toolbar::TopCenter: case Toolbar::TopRight: dtty = screen->getToolbar()->getExposedHeight() + - frame.border_w; + frame.border_w; dbby = screen->getHeight(); break; default: dtty = 0; - dbby = screen->getToolbar()->getY(); + dbby = screen->getToolbar()->getY(); break; } dty = dy - dtty; dby = dbby - (dy + frame.snap_h); - if (dy > 0 && dty < screen->getEdgeSnapThreshold()) dy = dtty; + if (dy > 0 && dty < screen->getEdgeSnapThreshold()) dy = dtty; else if (dby > 0 && dby < screen->getEdgeSnapThreshold()) dy = dbby - frame.snap_h; } if (screen->doOpaqueMove()) { - configure(dx, dy, frame.width, frame.height); + configure(dx, dy, frame.width, frame.height); } else { - XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), - frame.move_x, frame.move_y, frame.resize_w, - frame.resize_h); + XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), + frame.move_x, frame.move_y, frame.resize_w, + frame.resize_h); - frame.move_x = dx; - frame.move_y = dy; + frame.move_x = dx; + frame.move_y = dy; - XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), - frame.move_x, frame.move_y, frame.resize_w, - frame.resize_h); + XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), + frame.move_x, frame.move_y, frame.resize_w, + frame.resize_h); } screen->showPosition(dx, dy); } } else if (functions.resize && - (((me->state & Button1Mask) && + (((me->state & Button1Mask) && (me->window == frame.right_grip || me->window == frame.left_grip)) || - (me->state & (Mod1Mask | Button3Mask) && - me->window == frame.window))) { + (me->state & (Mod1Mask | Button3Mask) && + me->window == frame.window))) { Bool left = (me->window == frame.left_grip); if (! flags.resizing) { @@ -2719,17 +2719,17 @@ void BlackboxWindow::motionNotifyEvent(XMotionEvent *me) { if (left) left_fixsize(&gx, &gy); else - right_fixsize(&gx, &gy); + right_fixsize(&gx, &gy); screen->showGeometry(gx, gy); XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), - frame.resize_x, frame.resize_y, - frame.resize_w, frame.resize_h); + frame.resize_x, frame.resize_y, + frame.resize_w, frame.resize_h); } else { XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), - frame.resize_x, frame.resize_y, - frame.resize_w, frame.resize_h); + frame.resize_x, frame.resize_y, + frame.resize_w, frame.resize_h); int gx, gy; @@ -2743,15 +2743,15 @@ void BlackboxWindow::motionNotifyEvent(XMotionEvent *me) { left_fixsize(&gx, &gy); } else { - frame.resize_w = frame.width + (me->x - frame.grab_x); - if (frame.resize_w < 1) frame.resize_w = 1; + frame.resize_w = frame.width + (me->x - frame.grab_x); + if (frame.resize_w < 1) frame.resize_w = 1; - right_fixsize(&gx, &gy); + right_fixsize(&gx, &gy); } XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), - frame.resize_x, frame.resize_y, - frame.resize_w, frame.resize_h); + frame.resize_x, frame.resize_y, + frame.resize_w, frame.resize_h); screen->showGeometry(gx, gy); } @@ -2765,9 +2765,9 @@ void BlackboxWindow::shapeEvent(XShapeEvent *) { if (flags.shaped) { if (! validateClient()) return; XShapeCombineShape(display, frame.window, ShapeBounding, - frame.mwm_border_w, frame.y_border + - frame.mwm_border_w, client.window, - ShapeBounding, ShapeSet); + frame.mwm_border_w, frame.y_border + + frame.mwm_border_w, client.window, + ShapeBounding, ShapeSet); int num = 1; XRectangle xrect[2]; @@ -2776,15 +2776,15 @@ void BlackboxWindow::shapeEvent(XShapeEvent *) { xrect[0].height = frame.y_border; if (decorations.handle) { - xrect[1].x = 0; - xrect[1].y = frame.y_handle; - xrect[1].width = frame.width; - xrect[1].height = frame.handle_h + frame.border_w; - num++; + xrect[1].x = 0; + xrect[1].y = frame.y_handle; + xrect[1].width = frame.width; + xrect[1].height = frame.handle_h + frame.border_w; + num++; } XShapeCombineRectangles(display, frame.window, ShapeBounding, 0, 0, - xrect, num, ShapeUnion, Unsorted); + xrect, num, ShapeUnion, Unsorted); } } } @@ -2893,7 +2893,7 @@ void BlackboxWindow::changeBlackboxHints(BlackboxHints *net) { case DecorTool: decorations.titlebar = decorations.menu = functions.move = True; decorations.iconify = decorations.border = decorations.handle = - decorations.maximize = False; + decorations.maximize = False; break; } @@ -2933,10 +2933,10 @@ void BlackboxWindow::upsize(void) { WindowStyle *style = screen->getWindowStyle(); if (i18n.multibyte()) frame.title_h = (style->fontset_extents->max_ink_extent.height + - (frame.bevel_w * 2) + 2); + (frame.bevel_w * 2) + 2); else frame.title_h = (style->font->ascent + style->font->descent + - (frame.bevel_w * 2) + 2); + (frame.bevel_w * 2) + 2); frame.label_h = frame.title_h - (frame.bevel_w * 2); frame.button_w = frame.button_h = (frame.label_h - 2); diff --git a/src/Window.hh b/src/Window.hh index 7d555958..a516b665 100644 --- a/src/Window.hh +++ b/src/Window.hh @@ -80,7 +80,7 @@ private: unsigned long current_state; enum FocusMode { F_NoInput = 0, F_Passive, - F_LocallyActive, F_GloballyActive }; + F_LocallyActive, F_GloballyActive }; FocusMode focus_mode; struct _flags { @@ -197,7 +197,7 @@ private: protected: Bool getState(void); Window createToplevelWindow(int x, int y, unsigned int width, - unsigned int height, unsigned int borderwidth); + unsigned int height, unsigned int borderwidth); Window createChildWindow(Window parent, Cursor = None); void getWMName(void); diff --git a/src/Windowmenu.cc b/src/Windowmenu.cc index b71b328d..93d59f4c 100644 --- a/src/Windowmenu.cc +++ b/src/Windowmenu.cc @@ -47,23 +47,23 @@ Windowmenu::Windowmenu(BlackboxWindow *win) : Basemenu(win->getScreen()) { sendToMenu = new SendtoWorkspacemenu(this); insert(i18n(WindowmenuSet, WindowmenuSendTo, "Send To ..."), - sendToMenu); + sendToMenu); insert(i18n(WindowmenuSet, WindowmenuShade, "Shade"), - BScreen::WindowShade); + BScreen::WindowShade); insert(i18n(WindowmenuSet, WindowmenuIconify, "Iconify"), - BScreen::WindowIconify); + BScreen::WindowIconify); insert(i18n(WindowmenuSet, WindowmenuMaximize, "Maximize"), - BScreen::WindowMaximize); + BScreen::WindowMaximize); insert(i18n(WindowmenuSet, WindowmenuRaise,"Raise"), - BScreen::WindowRaise); + BScreen::WindowRaise); insert(i18n(WindowmenuSet, WindowmenuLower, "Lower"), - BScreen::WindowLower); + BScreen::WindowLower); insert(i18n(WindowmenuSet, WindowmenuStick, "Stick"), - BScreen::WindowStick); + BScreen::WindowStick); insert(i18n(WindowmenuSet, WindowmenuKillClient, "Kill Client"), - BScreen::WindowKill); + BScreen::WindowKill); insert(i18n(WindowmenuSet, WindowmenuClose, "Close"), - BScreen::WindowClose); + BScreen::WindowClose); update(); diff --git a/src/Workspace.cc b/src/Workspace.cc index 6cf26f55..2f3ad807 100644 --- a/src/Workspace.cc +++ b/src/Workspace.cc @@ -113,10 +113,10 @@ const int Workspace::removeWindow(BlackboxWindow *w) { } else { BlackboxWindow *top = stackingList->first(); if (! top || ! top->setInputFocus()) { - screen->getBlackbox()->setFocusedWindow((BlackboxWindow *) 0); - XSetInputFocus(screen->getBlackbox()->getXDisplay(), - screen->getToolbar()->getWindowID(), - RevertToParent, CurrentTime); + screen->getBlackbox()->setFocusedWindow((BlackboxWindow *) 0); + XSetInputFocus(screen->getBlackbox()->getXDisplay(), + screen->getToolbar()->getWindowID(), + RevertToParent, CurrentTime); } } } @@ -341,38 +341,38 @@ void Workspace::placeWindow(BlackboxWindow *win) { start_pos_y : availableArea.height - win_h - start_pos_y; while (!placed && - ((screen->getColPlacementDirection() == BScreen::BottomTop) ? - place_y > 0 : place_y + win_h < (signed) availableArea.height)) { + ((screen->getColPlacementDirection() == BScreen::BottomTop) ? + place_y > 0 : place_y + win_h < (signed) availableArea.height)) { place_x = (screen->getRowPlacementDirection() == BScreen::LeftRight) ? - start_pos_x : availableArea.width - win_w - start_pos_x; + start_pos_x : availableArea.width - win_w - start_pos_x; while (!placed && - ((screen->getRowPlacementDirection() == BScreen::RightLeft) ? - place_x > 0 : place_x + win_w < (signed) availableArea.width)) { + ((screen->getRowPlacementDirection() == BScreen::RightLeft) ? + place_x > 0 : place_x + win_w < (signed) availableArea.width)) { placed = True; it.reset(); for (BlackboxWindow *curr = it.current(); placed && curr; - it++, curr = it.current()) { + it++, curr = it.current()) { int curr_w = curr->getWidth() + (screen->getBorderWidth() * 4); int curr_h = ((curr->isShaded()) ? curr->getTitleHeight() : curr->getHeight()) + (screen->getBorderWidth() * 4); - + if (curr->getXFrame() < place_x + win_w && curr->getXFrame() + curr_w > place_x && curr->getYFrame() < place_y + win_h && curr->getYFrame() + curr_h > place_y) { placed = False; - } + } } if (! placed) - place_x += (change_x * delta_x); + place_x += (change_x * delta_x); } if (! placed) - place_y += (change_y * delta_y); + place_y += (change_y * delta_y); } break; @@ -383,19 +383,19 @@ void Workspace::placeWindow(BlackboxWindow *win) { start_pos_x : availableArea.width - win_w - start_pos_x; while (!placed && - ((screen->getRowPlacementDirection() == BScreen::RightLeft) ? - place_x > 0 : place_x + win_w < (signed) availableArea.width)) { + ((screen->getRowPlacementDirection() == BScreen::RightLeft) ? + place_x > 0 : place_x + win_w < (signed) availableArea.width)) { place_y = (screen->getColPlacementDirection() == BScreen::TopBottom) ? - start_pos_y : availableArea.height - win_h - start_pos_y; + start_pos_y : availableArea.height - win_h - start_pos_y; while (!placed && - ((screen->getColPlacementDirection() == BScreen::BottomTop) ? - place_y > 0 : place_y + win_h < (signed) availableArea.height)){ + ((screen->getColPlacementDirection() == BScreen::BottomTop) ? + place_y > 0 : place_y + win_h < (signed) availableArea.height)){ placed = True; it.reset(); for (BlackboxWindow *curr = it.current(); placed && curr; - it++, curr = it.current()) { + it++, curr = it.current()) { int curr_w = curr->getWidth() + (screen->getBorderWidth() * 4); int curr_h = ((curr->isShaded()) ? curr->getTitleHeight() : @@ -406,15 +406,15 @@ void Workspace::placeWindow(BlackboxWindow *win) { curr->getYFrame() < place_y + win_h && curr->getYFrame() + curr_h > place_y) { placed = False; - } + } } - if (! placed) - place_y += (change_y * delta_y); + if (! placed) + place_y += (change_y * delta_y); } if (! placed) - place_x += (change_x * delta_x); + place_x += (change_x * delta_x); } break; @@ -423,7 +423,7 @@ void Workspace::placeWindow(BlackboxWindow *win) { if (! placed) { if (((unsigned) cascade_x > (availableArea.width / (unsigned) 2)) || - ((unsigned) cascade_y > (availableArea.height / (unsigned) 2))) + ((unsigned) cascade_y > (availableArea.height / (unsigned) 2))) cascade_x = cascade_y = 32; place_x = cascade_x; diff --git a/src/Workspacemenu.cc b/src/Workspacemenu.cc index 4b8ef1eb..3fe7b54b 100644 --- a/src/Workspacemenu.cc +++ b/src/Workspacemenu.cc @@ -56,7 +56,7 @@ void Workspacemenu::itemSelected(int button, int index) { else if (index == 1) screen->removeLastWorkspace(); else if ((screen->getCurrentWorkspace()->getWorkspaceID() != - (index - 2)) && ((index - 2) < screen->getCount())) + (index - 2)) && ((index - 2) < screen->getCount())) screen->changeWorkspaceID(index - 2); if (! (screen->getWorkspacemenu()->isTorn() || isTorn())) diff --git a/src/blackbox.cc b/src/blackbox.cc index ba82e046..2333f054 100644 --- a/src/blackbox.cc +++ b/src/blackbox.cc @@ -198,7 +198,7 @@ Blackbox::Blackbox(int m_argc, char **m_argv, char *dpy_name, char *rc) if (! screenList->count()) { fprintf(stderr, - i18n(blackboxSet, blackboxNoManagableScreens, + i18n(blackboxSet, blackboxNoManagableScreens, "Blackbox::Blackbox: no managable screens found, aborting.\n")); ::exit(3); } @@ -271,7 +271,7 @@ void Blackbox::process_event(XEvent *e) { win->buttonPressEvent(&e->xbutton); if (e->xbutton.button == 1) - win->installColormap(True); + win->installColormap(True); } else if ((menu = searchMenu(e->xbutton.window))) { menu->buttonPressEvent(&e->xbutton); @@ -286,70 +286,70 @@ void Blackbox::process_event(XEvent *e) { LinkedListIterator it(screenList); BScreen *screen = it.current(); for (; screen; it++, screen = it.current()) { - if (e->xbutton.window == screen->getRootWindow()) { - if (e->xbutton.button == 1) { + if (e->xbutton.window == screen->getRootWindow()) { + if (e->xbutton.button == 1) { if (! screen->isRootColormapInstalled()) - screen->getImageControl()->installRootColormap(); + screen->getImageControl()->installRootColormap(); - if (screen->getWorkspacemenu()->isVisible()) - screen->getWorkspacemenu()->hide(); + if (screen->getWorkspacemenu()->isVisible()) + screen->getWorkspacemenu()->hide(); if (screen->getRootmenu()->isVisible()) screen->getRootmenu()->hide(); } else if (e->xbutton.button == 2) { - int mx = e->xbutton.x_root - - (screen->getWorkspacemenu()->getWidth() / 2); - int my = e->xbutton.y_root - - (screen->getWorkspacemenu()->getTitleHeight() / 2); - - if (mx < 0) mx = 0; - if (my < 0) my = 0; - - if (mx + screen->getWorkspacemenu()->getWidth() > - screen->getWidth()) - mx = screen->getWidth() - - screen->getWorkspacemenu()->getWidth() - - screen->getBorderWidth(); - - if (my + screen->getWorkspacemenu()->getHeight() > - screen->getHeight()) - my = screen->getHeight() - - screen->getWorkspacemenu()->getHeight() - - screen->getBorderWidth(); - - screen->getWorkspacemenu()->move(mx, my); - - if (! screen->getWorkspacemenu()->isVisible()) { - screen->getWorkspacemenu()->removeParent(); - screen->getWorkspacemenu()->show(); - } - } else if (e->xbutton.button == 3) { - int mx = e->xbutton.x_root - - (screen->getRootmenu()->getWidth() / 2); - int my = e->xbutton.y_root - - (screen->getRootmenu()->getTitleHeight() / 2); - - if (mx < 0) mx = 0; - if (my < 0) my = 0; - - if (mx + screen->getRootmenu()->getWidth() > screen->getWidth()) - mx = screen->getWidth() - - screen->getRootmenu()->getWidth() - - screen->getBorderWidth(); - - if (my + screen->getRootmenu()->getHeight() > screen->getHeight()) + int mx = e->xbutton.x_root - + (screen->getWorkspacemenu()->getWidth() / 2); + int my = e->xbutton.y_root - + (screen->getWorkspacemenu()->getTitleHeight() / 2); + + if (mx < 0) mx = 0; + if (my < 0) my = 0; + + if (mx + screen->getWorkspacemenu()->getWidth() > + screen->getWidth()) + mx = screen->getWidth() - + screen->getWorkspacemenu()->getWidth() - + screen->getBorderWidth(); + + if (my + screen->getWorkspacemenu()->getHeight() > + screen->getHeight()) + my = screen->getHeight() - + screen->getWorkspacemenu()->getHeight() - + screen->getBorderWidth(); + + screen->getWorkspacemenu()->move(mx, my); + + if (! screen->getWorkspacemenu()->isVisible()) { + screen->getWorkspacemenu()->removeParent(); + screen->getWorkspacemenu()->show(); + } + } else if (e->xbutton.button == 3) { + int mx = e->xbutton.x_root - + (screen->getRootmenu()->getWidth() / 2); + int my = e->xbutton.y_root - + (screen->getRootmenu()->getTitleHeight() / 2); + + if (mx < 0) mx = 0; + if (my < 0) my = 0; + + if (mx + screen->getRootmenu()->getWidth() > screen->getWidth()) + mx = screen->getWidth() - + screen->getRootmenu()->getWidth() - + screen->getBorderWidth(); + + if (my + screen->getRootmenu()->getHeight() > screen->getHeight()) my = screen->getHeight() - screen->getRootmenu()->getHeight() - screen->getBorderWidth(); - screen->getRootmenu()->move(mx, my); + screen->getRootmenu()->move(mx, my); - if (! screen->getRootmenu()->isVisible()) { - checkMenu(); - screen->getRootmenu()->show(); - } - } - } + if (! screen->getRootmenu()->isVisible()) { + checkMenu(); + screen->getRootmenu()->show(); + } + } + } } } @@ -381,7 +381,7 @@ void Blackbox::process_event(XEvent *e) { XEvent realevent; unsigned int i = 0; while(XCheckTypedWindowEvent(getXDisplay(), e->xconfigurerequest.window, - ConfigureRequest, &realevent)) { + ConfigureRequest, &realevent)) { i++; } if ( i > 0 ) @@ -403,18 +403,18 @@ void Blackbox::process_event(XEvent *e) { } else { if (validateWindow(e->xconfigurerequest.window)) { - XWindowChanges xwc; - - xwc.x = e->xconfigurerequest.x; - xwc.y = e->xconfigurerequest.y; - xwc.width = e->xconfigurerequest.width; - xwc.height = e->xconfigurerequest.height; - xwc.border_width = e->xconfigurerequest.border_width; - xwc.sibling = e->xconfigurerequest.above; - xwc.stack_mode = e->xconfigurerequest.detail; - - XConfigureWindow(getXDisplay(), e->xconfigurerequest.window, - e->xconfigurerequest.value_mask, &xwc); + XWindowChanges xwc; + + xwc.x = e->xconfigurerequest.x; + xwc.y = e->xconfigurerequest.y; + xwc.width = e->xconfigurerequest.width; + xwc.height = e->xconfigurerequest.height; + xwc.border_width = e->xconfigurerequest.border_width; + xwc.sibling = e->xconfigurerequest.above; + xwc.stack_mode = e->xconfigurerequest.detail; + + XConfigureWindow(getXDisplay(), e->xconfigurerequest.window, + e->xconfigurerequest.value_mask, &xwc); } } @@ -424,9 +424,9 @@ void Blackbox::process_event(XEvent *e) { case MapRequest: { #ifdef DEBUG fprintf(stderr, - i18n(blackboxSet, blackboxMapRequest, - "Blackbox::process_event(): MapRequest for 0x%lx\n"), - e->xmaprequest.window); + i18n(blackboxSet, blackboxMapRequest, + "Blackbox::process_event(): MapRequest for 0x%lx\n"), + e->xmaprequest.window); #endif // DEBUG BlackboxWindow *win = searchWindow(e->xmaprequest.window); @@ -459,7 +459,7 @@ void Blackbox::process_event(XEvent *e) { if ((win = searchWindow(e->xunmap.window))) { win->unmapNotifyEvent(&e->xunmap); if (focused_window == win) - focused_window = (BlackboxWindow *) 0; + focused_window = (BlackboxWindow *) 0; #ifdef SLIT } else if ((slit = searchSlit(e->xunmap.window))) { slit->removeClient(e->xunmap.window); @@ -480,7 +480,7 @@ void Blackbox::process_event(XEvent *e) { if ((win = searchWindow(e->xdestroywindow.window))) { win->destroyNotifyEvent(&e->xdestroywindow); if (focused_window == win) - focused_window = (BlackboxWindow *) 0; + focused_window = (BlackboxWindow *) 0; #ifdef SLIT } else if ((slit = searchSlit(e->xdestroywindow.window))) { slit->removeClient(e->xdestroywindow.window, False); @@ -501,7 +501,7 @@ void Blackbox::process_event(XEvent *e) { } else { Slit *slit = searchSlit(e->xreparent.window); if (slit) - slit->removeClient(e->xreparent.window, True); + slit->removeClient(e->xreparent.window, True); } break; } @@ -511,7 +511,7 @@ void Blackbox::process_event(XEvent *e) { XEvent realevent; unsigned int i = 0; while (XCheckTypedWindowEvent(getXDisplay(), e->xmotion.window, - MotionNotify, &realevent)) { + MotionNotify, &realevent)) { i++; } @@ -542,7 +542,7 @@ void Blackbox::process_event(XEvent *e) { BlackboxWindow *win = searchWindow(e->xproperty.window); if (win) - win->propertyNotifyEvent(e->xproperty.atom); + win->propertyNotifyEvent(e->xproperty.atom); } break; @@ -569,14 +569,14 @@ void Blackbox::process_event(XEvent *e) { XCheckIfEvent(getXDisplay(), &dummy, queueScanner, (char *) &sa); if ((e->xcrossing.window == e->xcrossing.root) && - (screen = searchScreen(e->xcrossing.window))) { + (screen = searchScreen(e->xcrossing.window))) { screen->getImageControl()->installRootColormap(); } else if ((win = searchWindow(e->xcrossing.window))) { if (win->getScreen()->isSloppyFocus() && - (! win->isFocused()) && (! no_focus)) { + (! win->isFocused()) && (! no_focus)) { if (((! sa.leave) || sa.inferior) && win->isVisible() && win->setInputFocus()) - win->installColormap(True); + win->installColormap(True); } } else if ((menu = searchMenu(e->xcrossing.window))) { menu->enterNotifyEvent(&e->xcrossing); @@ -625,16 +625,16 @@ void Blackbox::process_event(XEvent *e) { ex2 = ex1 + e->xexpose.width - 1; ey2 = ey1 + e->xexpose.height - 1; while (XCheckTypedWindowEvent(getXDisplay(), e->xexpose.window, - Expose, &realevent)) { + Expose, &realevent)) { i++; // merge expose area ex1 = std::min(realevent.xexpose.x, ex1); ey1 = std::min(realevent.xexpose.y, ey1); ex2 = std::max(realevent.xexpose.x + realevent.xexpose.width - 1, - ex2); + ex2); ey2 = std::max(realevent.xexpose.y + realevent.xexpose.height - 1, - ey2); + ey2); } if ( i > 0 ) e = &realevent; @@ -673,7 +673,7 @@ void Blackbox::process_event(XEvent *e) { if (screen) screen->setRootColormapInstalled((e->xcolormap.state == - ColormapInstalled) ? True : False); + ColormapInstalled) ? True : False); break; } @@ -699,19 +699,19 @@ void Blackbox::process_event(XEvent *e) { if (! win || ! win->validateClient()) return; if (e->xclient.data.l[0] == IconicState) - win->iconify(); + win->iconify(); if (e->xclient.data.l[0] == NormalState) win->deiconify(); } else if(e->xclient.message_type == getBlackboxChangeWorkspaceAtom()) { - BScreen *screen = searchScreen(e->xclient.window); + BScreen *screen = searchScreen(e->xclient.window); - if (screen && e->xclient.data.l[0] >= 0 && - e->xclient.data.l[0] < screen->getCount()) - screen->changeWorkspaceID(e->xclient.data.l[0]); + if (screen && e->xclient.data.l[0] >= 0 && + e->xclient.data.l[0] < screen->getCount()) + screen->changeWorkspaceID(e->xclient.data.l[0]); } else if (e->xclient.message_type == getBlackboxChangeWindowFocusAtom()) { - BlackboxWindow *win = searchWindow(e->xclient.window); + BlackboxWindow *win = searchWindow(e->xclient.window); - if (win && win->isVisible() && win->setInputFocus()) + if (win && win->isVisible() && win->setInputFocus()) win->installColormap(True); } else if (e->xclient.message_type == getBlackboxCycleWindowFocusAtom()) { BScreen *screen = searchScreen(e->xclient.window); @@ -721,20 +721,20 @@ void Blackbox::process_event(XEvent *e) { screen->prevFocus(); else screen->nextFocus(); - } + } } else if (e->xclient.message_type == getBlackboxChangeAttributesAtom()) { - BlackboxWindow *win = searchWindow(e->xclient.window); - - if (win && win->validateClient()) { - BlackboxHints net; - net.flags = e->xclient.data.l[0]; - net.attrib = e->xclient.data.l[1]; - net.workspace = e->xclient.data.l[2]; - net.stack = e->xclient.data.l[3]; - net.decoration = e->xclient.data.l[4]; - - win->changeBlackboxHints(&net); - } + BlackboxWindow *win = searchWindow(e->xclient.window); + + if (win && win->validateClient()) { + BlackboxHints net; + net.flags = e->xclient.data.l[0]; + net.attrib = e->xclient.data.l[1]; + net.workspace = e->xclient.data.l[2]; + net.stack = e->xclient.data.l[3]; + net.decoration = e->xclient.data.l[4]; + + win->changeBlackboxHints(&net); + } } } @@ -752,8 +752,8 @@ void Blackbox::process_event(XEvent *e) { BlackboxWindow *win = (BlackboxWindow *) 0; if ((win = searchWindow(e->xany.window)) || - (shape_event->kind != ShapeBounding)) - win->shapeEvent(shape_event); + (shape_event->kind != ShapeBounding)) + win->shapeEvent(shape_event); } #endif // SHAPE } @@ -1035,7 +1035,7 @@ void Blackbox::save_rc(void) { } sprintf(rc_string, "session.screen%d.slit.placement: %s", screen_number, - slit_placement); + slit_placement); XrmPutLineResource(&new_blackboxrc, rc_string); sprintf(rc_string, "session.screen%d.slit.direction: %s", screen_number, @@ -1053,15 +1053,15 @@ void Blackbox::save_rc(void) { #endif // SLIT sprintf(rc_string, "session.opaqueMove: %s", - ((screen->doOpaqueMove()) ? "True" : "False")); + ((screen->doOpaqueMove()) ? "True" : "False")); XrmPutLineResource(&new_blackboxrc, rc_string); sprintf(rc_string, "session.imageDither: %s", - ((screen->getImageControl()->doDither()) ? "True" : "False")); + ((screen->getImageControl()->doDither()) ? "True" : "False")); XrmPutLineResource(&new_blackboxrc, rc_string); sprintf(rc_string, "session.screen%d.fullMaximization: %s", screen_number, - ((screen->doFullMax()) ? "True" : "False")); + ((screen->doFullMax()) ? "True" : "False")); XrmPutLineResource(&new_blackboxrc, rc_string); sprintf(rc_string, "session.screen%d.focusNewWindows: %s", screen_number, @@ -1069,19 +1069,19 @@ void Blackbox::save_rc(void) { XrmPutLineResource(&new_blackboxrc, rc_string); sprintf(rc_string, "session.screen%d.focusLastWindow: %s", screen_number, - ((screen->doFocusLast()) ? "True" : "False")); + ((screen->doFocusLast()) ? "True" : "False")); XrmPutLineResource(&new_blackboxrc, rc_string); sprintf(rc_string, "session.screen%d.rowPlacementDirection: %s", - screen_number, - ((screen->getRowPlacementDirection() == BScreen::LeftRight) ? - "LeftToRight" : "RightToLeft")); + screen_number, + ((screen->getRowPlacementDirection() == BScreen::LeftRight) ? + "LeftToRight" : "RightToLeft")); XrmPutLineResource(&new_blackboxrc, rc_string); sprintf(rc_string, "session.screen%d.colPlacementDirection: %s", - screen_number, - ((screen->getColPlacementDirection() == BScreen::TopBottom) ? - "TopToBottom" : "BottomToTop")); + screen_number, + ((screen->getColPlacementDirection() == BScreen::TopBottom) ? + "TopToBottom" : "BottomToTop")); XrmPutLineResource(&new_blackboxrc, rc_string); char *placement = (char *) 0; @@ -1100,27 +1100,27 @@ void Blackbox::save_rc(void) { break; } sprintf(rc_string, "session.screen%d.windowPlacement: %s", screen_number, - placement); + placement); XrmPutLineResource(&new_blackboxrc, rc_string); sprintf(rc_string, "session.screen%d.focusModel: %s", screen_number, - ((screen->isSloppyFocus()) ? - ((screen->doAutoRaise()) ? "AutoRaiseSloppyFocus" : - "SloppyFocus") : - "ClickToFocus")); + ((screen->isSloppyFocus()) ? + ((screen->doAutoRaise()) ? "AutoRaiseSloppyFocus" : + "SloppyFocus") : + "ClickToFocus")); XrmPutLineResource(&new_blackboxrc, rc_string); sprintf(rc_string, "session.screen%d.workspaces: %d", screen_number, - screen->getCount()); + screen->getCount()); XrmPutLineResource(&new_blackboxrc, rc_string); sprintf(rc_string, "session.screen%d.toolbar.onTop: %s", screen_number, - ((screen->getToolbar()->isOnTop()) ? "True" : "False")); + ((screen->getToolbar()->isOnTop()) ? "True" : "False")); XrmPutLineResource(&new_blackboxrc, rc_string); sprintf(rc_string, "session.screen%d.toolbar.autoHide: %s", screen_number, - ((screen->getToolbar()->doAutoHide()) ? "True" : "False")); + ((screen->getToolbar()->doAutoHide()) ? "True" : "False")); XrmPutLineResource(&new_blackboxrc, rc_string); char *toolbar_placement = (char *) 0; @@ -1149,22 +1149,22 @@ void Blackbox::save_rc(void) { #ifdef HAVE_STRFTIME sprintf(rc_string, "session.screen%d.strftimeFormat: %s", screen_number, - screen->getStrftimeFormat()); + screen->getStrftimeFormat()); XrmPutLineResource(&new_blackboxrc, rc_string); #else // !HAVE_STRFTIME sprintf(rc_string, "session.screen%d.dateFormat: %s", screen_number, - ((screen->getDateFormat() == B_EuropeanDate) ? - "European" : "American")); + ((screen->getDateFormat() == B_EuropeanDate) ? + "European" : "American")); XrmPutLineResource(&new_blackboxrc, rc_string); sprintf(rc_string, "session.screen%d.clockFormat: %d", screen_number, - ((screen->isClock24Hour()) ? 24 : 12)); + ((screen->isClock24Hour()) ? 24 : 12)); XrmPutLineResource(&new_blackboxrc, rc_string); #endif // HAVE_STRFTIME sprintf(rc_string, "session.screen%d.edgeSnapThreshold: %d", screen_number, - screen->getEdgeSnapThreshold()); + screen->getEdgeSnapThreshold()); XrmPutLineResource(&new_blackboxrc, rc_string); sprintf(rc_string, "session.screen%d.toolbar.widthPercent: %d", @@ -1175,28 +1175,28 @@ void Blackbox::save_rc(void) { int i, len = 0; for (i = 0; i < screen->getCount(); i++) len += strlen((screen->getWorkspace(i)->getName()) ? - screen->getWorkspace(i)->getName() : "Null") + 1; + screen->getWorkspace(i)->getName() : "Null") + 1; char *resource_string = new char[len + 1024], *save_string = new char[len], *save_string_pos = save_string, *name_string_pos; if (save_string) { for (i = 0; i < screen->getCount(); i++) { - len = strlen((screen->getWorkspace(i)->getName()) ? - screen->getWorkspace(i)->getName() : "Null") + 1; - name_string_pos = - (char *) ((screen->getWorkspace(i)->getName()) ? - screen->getWorkspace(i)->getName() : "Null"); - - while (--len) *(save_string_pos++) = *(name_string_pos++); - *(save_string_pos++) = ','; + len = strlen((screen->getWorkspace(i)->getName()) ? + screen->getWorkspace(i)->getName() : "Null") + 1; + name_string_pos = + (char *) ((screen->getWorkspace(i)->getName()) ? + screen->getWorkspace(i)->getName() : "Null"); + + while (--len) *(save_string_pos++) = *(name_string_pos++); + *(save_string_pos++) = ','; } } *(--save_string_pos) = '\0'; sprintf(resource_string, "session.screen%d.workspaceNames: %s", - screen_number, save_string); + screen_number, save_string); XrmPutLineResource(&new_blackboxrc, resource_string); delete [] resource_string; @@ -1223,13 +1223,13 @@ void Blackbox::load_rc(void) { delete [] resource.menu_file; if (XrmGetResource(database, "session.menuFile", "Session.MenuFile", - &value_type, &value)) + &value_type, &value)) resource.menu_file = expandTilde(value.addr); else resource.menu_file = bstrdup(DEFAULTMENU); if (XrmGetResource(database, "session.colorsPerChannel", - "Session.ColorsPerChannel", &value_type, &value)) { + "Session.ColorsPerChannel", &value_type, &value)) { if (sscanf(value.addr, "%d", &resource.colors_per_channel) != 1) { resource.colors_per_channel = 4; } else { @@ -1244,13 +1244,13 @@ void Blackbox::load_rc(void) { delete [] resource.style_file; if (XrmGetResource(database, "session.styleFile", "Session.StyleFile", - &value_type, &value)) + &value_type, &value)) resource.style_file = bstrdup(value.addr); else resource.style_file = bstrdup(DEFAULTSTYLE); if (XrmGetResource(database, "session.doubleClickInterval", - "Session.DoubleClickInterval", &value_type, &value)) { + "Session.DoubleClickInterval", &value_type, &value)) { if (sscanf(value.addr, "%lu", &resource.double_click_interval) != 1) resource.double_click_interval = 250; } else { @@ -1324,7 +1324,7 @@ void Blackbox::load_rc(BScreen *screen) { sprintf(name_lookup, "session.screen%d.focusLastWindow", screen_number); sprintf(class_lookup, "Session.Screen%d.focusLastWindow", screen_number); if (XrmGetResource(database, name_lookup, class_lookup, &value_type, - &value)) { + &value)) { if (! strncasecmp(value.addr, "true", value.size)) screen->saveFocusLast(True); else @@ -1333,11 +1333,11 @@ void Blackbox::load_rc(BScreen *screen) { screen->saveFocusLast(False); } sprintf(name_lookup, "session.screen%d.rowPlacementDirection", - screen_number); + screen_number); sprintf(class_lookup, "Session.Screen%d.RowPlacementDirection", - screen_number); + screen_number); if (XrmGetResource(database, name_lookup, class_lookup, &value_type, - &value)) { + &value)) { if (! strncasecmp(value.addr, "righttoleft", value.size)) screen->saveRowPlacementDirection(BScreen::RightLeft); else @@ -1346,11 +1346,11 @@ void Blackbox::load_rc(BScreen *screen) { screen->saveRowPlacementDirection(BScreen::LeftRight); } sprintf(name_lookup, "session.screen%d.colPlacementDirection", - screen_number); + screen_number); sprintf(class_lookup, "Session.Screen%d.ColPlacementDirection", - screen_number); + screen_number); if (XrmGetResource(database, name_lookup, class_lookup, &value_type, - &value)) { + &value)) { if (! strncasecmp(value.addr, "bottomtotop", value.size)) screen->saveColPlacementDirection(BScreen::BottomTop); else @@ -1361,7 +1361,7 @@ void Blackbox::load_rc(BScreen *screen) { sprintf(name_lookup, "session.screen%d.workspaces", screen_number); sprintf(class_lookup, "Session.Screen%d.Workspaces", screen_number); if (XrmGetResource(database, name_lookup, class_lookup, &value_type, - &value)) { + &value)) { int i; if (sscanf(value.addr, "%d", &i) != 1) i = 1; screen->saveWorkspaces(i); @@ -1373,7 +1373,7 @@ void Blackbox::load_rc(BScreen *screen) { sprintf(class_lookup, "Session.Screen%d.Toolbar.WidthPercent", screen_number); if (XrmGetResource(database, name_lookup, class_lookup, &value_type, - &value)) { + &value)) { int i; if (sscanf(value.addr, "%d", &i) != 1) i = 66; @@ -1408,7 +1408,7 @@ void Blackbox::load_rc(BScreen *screen) { sprintf(name_lookup, "session.screen%d.workspaceNames", screen_number); sprintf(class_lookup, "Session.Screen%d.WorkspaceNames", screen_number); if (XrmGetResource(database, name_lookup, class_lookup, &value_type, - &value)) { + &value)) { char *search = bstrdup(value.addr); for (int i = 0; i < screen->getNumberOfWorkspaces(); i++) { @@ -1427,7 +1427,7 @@ void Blackbox::load_rc(BScreen *screen) { sprintf(name_lookup, "session.screen%d.toolbar.onTop", screen_number); sprintf(class_lookup, "Session.Screen%d.Toolbar.OnTop", screen_number); if (XrmGetResource(database, name_lookup, class_lookup, &value_type, - &value)) { + &value)) { if (! strncasecmp(value.addr, "true", value.size)) screen->saveToolbarOnTop(True); else @@ -1438,7 +1438,7 @@ void Blackbox::load_rc(BScreen *screen) { sprintf(name_lookup, "session.screen%d.toolbar.autoHide", screen_number); sprintf(class_lookup, "Session.Screen%d.Toolbar.autoHide", screen_number); if (XrmGetResource(database, name_lookup, class_lookup, &value_type, - &value)) { + &value)) { if (! strncasecmp(value.addr, "true", value.size)) screen->saveToolbarAutoHide(True); else @@ -1449,7 +1449,7 @@ void Blackbox::load_rc(BScreen *screen) { sprintf(name_lookup, "session.screen%d.focusModel", screen_number); sprintf(class_lookup, "Session.Screen%d.FocusModel", screen_number); if (XrmGetResource(database, name_lookup, class_lookup, &value_type, - &value)) { + &value)) { if (! strncasecmp(value.addr, "clicktofocus", value.size)) { screen->saveAutoRaise(False); screen->saveSloppyFocus(False); @@ -1468,7 +1468,7 @@ void Blackbox::load_rc(BScreen *screen) { sprintf(name_lookup, "session.screen%d.windowPlacement", screen_number); sprintf(class_lookup, "Session.Screen%d.WindowPlacement", screen_number); if (XrmGetResource(database, name_lookup, class_lookup, &value_type, - &value)) { + &value)) { if (! strncasecmp(value.addr, "RowSmartPlacement", value.size)) screen->savePlacementPolicy(BScreen::RowSmartPlacement); else if (! strncasecmp(value.addr, "ColSmartPlacement", value.size)) @@ -1482,7 +1482,7 @@ void Blackbox::load_rc(BScreen *screen) { sprintf(name_lookup, "session.screen%d.slit.placement", screen_number); sprintf(class_lookup, "Session.Screen%d.Slit.Placement", screen_number); if (XrmGetResource(database, name_lookup, class_lookup, &value_type, - &value)) { + &value)) { if (! strncasecmp(value.addr, "TopLeft", value.size)) screen->saveSlitPlacement(Slit::TopLeft); else if (! strncasecmp(value.addr, "CenterLeft", value.size)) @@ -1541,7 +1541,7 @@ void Blackbox::load_rc(BScreen *screen) { sprintf(name_lookup, "session.screen%d.strftimeFormat", screen_number); sprintf(class_lookup, "Session.Screen%d.StrftimeFormat", screen_number); if (XrmGetResource(database, name_lookup, class_lookup, &value_type, - &value)) { + &value)) { screen->saveStrftimeFormat(value.addr); } else { screen->saveStrftimeFormat("%I:%M %p"); @@ -1550,7 +1550,7 @@ void Blackbox::load_rc(BScreen *screen) { sprintf(name_lookup, "session.screen%d.dateFormat", screen_number); sprintf(class_lookup, "Session.Screen%d.DateFormat", screen_number); if (XrmGetResource(database, name_lookup, class_lookup, &value_type, - &value)) { + &value)) { if (strncasecmp(value.addr, "european", value.size)) screen->saveDateFormat(B_AmericanDate); else @@ -1561,7 +1561,7 @@ void Blackbox::load_rc(BScreen *screen) { sprintf(name_lookup, "session.screen%d.clockFormat", screen_number); sprintf(class_lookup, "Session.Screen%d.ClockFormat", screen_number); if (XrmGetResource(database, name_lookup, class_lookup, &value_type, - &value)) { + &value)) { int clock; if (sscanf(value.addr, "%d", &clock) != 1) screen->saveClock24Hour(False); else if (clock == 24) screen->saveClock24Hour(True); @@ -1574,7 +1574,7 @@ void Blackbox::load_rc(BScreen *screen) { sprintf(name_lookup, "session.screen%d.edgeSnapThreshold", screen_number); sprintf(class_lookup, "Session.Screen%d.EdgeSnapThreshold", screen_number); if (XrmGetResource(database, name_lookup, class_lookup, &value_type, - &value)) { + &value)) { int threshold; if (sscanf(value.addr, "%d", &threshold) != 1) screen->saveEdgeSnapThreshold(0); @@ -1586,7 +1586,7 @@ void Blackbox::load_rc(BScreen *screen) { sprintf(name_lookup, "session.screen%d.imageDither", screen_number); sprintf(class_lookup, "Session.Screen%d.ImageDither", screen_number); if (XrmGetResource(database, "session.imageDither", "Session.ImageDither", - &value_type, &value)) { + &value_type, &value)) { if (! strncasecmp("true", value.addr, value.size)) screen->saveImageDither(True); else @@ -1639,7 +1639,7 @@ void Blackbox::real_reconfigure(void) { if (ts) { if (ts->filename) - delete [] ts->filename; + delete [] ts->filename; delete ts; } @@ -1684,7 +1684,7 @@ void Blackbox::real_rereadMenu(void) { if (ts) { if (ts->filename) - delete [] ts->filename; + delete [] ts->filename; delete ts; } diff --git a/src/main.cc b/src/main.cc index 629bc55e..9a9e23ac 100644 --- a/src/main.cc +++ b/src/main.cc @@ -62,7 +62,7 @@ static void showHelp(int exitval) { " -rc \t\t\tuse alternate resource file.\n" " -version\t\t\tdisplay version and exit.\n" " -help\t\t\t\tdisplay this help text and exit.\n\n"), - __blackbox_version); + __blackbox_version); // some people have requested that we print out compile options // as well @@ -74,35 +74,35 @@ static void showHelp(int exitval) { " Slit:\t\t\t\t%s\n" " 8bpp Ordered Dithering:\t%s\n\n"), #ifdef DEBUG - i18n(CommonSet, CommonYes, "yes"), + i18n(CommonSet, CommonYes, "yes"), #else // !DEBUG - i18n(CommonSet, CommonNo, "no"), + i18n(CommonSet, CommonNo, "no"), #endif // DEBUG #ifdef INTERLACE - i18n(CommonSet, CommonYes, "yes"), + i18n(CommonSet, CommonYes, "yes"), #else // !INTERLACE - i18n(CommonSet, CommonNo, "no"), + i18n(CommonSet, CommonNo, "no"), #endif // INTERLACE #ifdef SHAPE - i18n(CommonSet, CommonYes, "yes"), + i18n(CommonSet, CommonYes, "yes"), #else // !SHAPE - i18n(CommonSet, CommonNo, "no"), + i18n(CommonSet, CommonNo, "no"), #endif // SHAPE #ifdef SLIT - i18n(CommonSet, CommonYes, "yes"), + i18n(CommonSet, CommonYes, "yes"), #else // !SLIT - i18n(CommonSet, CommonNo, "no"), + i18n(CommonSet, CommonNo, "no"), #endif // SLIT #ifdef ORDEREDPSEUDO - i18n(CommonSet, CommonYes, "yes") + i18n(CommonSet, CommonYes, "yes") #else // !ORDEREDPSEUDO - i18n(CommonSet, CommonNo, "no") + i18n(CommonSet, CommonNo, "no") #endif // ORDEREDPSEUDO - ); + ); ::exit(exitval); } @@ -119,8 +119,8 @@ int main(int argc, char **argv) { if ((++i) >= argc) { fprintf(stderr, - i18n(mainSet, mainRCRequiresArg, - "error: '-rc' requires and argument\n")); + i18n(mainSet, mainRCRequiresArg, + "error: '-rc' requires and argument\n")); ::exit(1); } @@ -131,11 +131,11 @@ int main(int argc, char **argv) { // set by the environment variable DISPLAY if ((++i) >= argc) { - fprintf(stderr, - i18n(mainSet, mainDISPLAYRequiresArg, - "error: '-display' requires an argument\n")); + fprintf(stderr, + i18n(mainSet, mainDISPLAYRequiresArg, + "error: '-display' requires an argument\n")); - ::exit(1); + ::exit(1); } session_display = argv[i]; @@ -143,14 +143,14 @@ int main(int argc, char **argv) { sprintf(dtmp, "DISPLAY=%s", session_display); if (putenv(dtmp)) { - fprintf(stderr, i18n(mainSet, mainWarnDisplaySet, - "warning: couldn't set environment variable 'DISPLAY'\n")); - perror("putenv()"); + fprintf(stderr, i18n(mainSet, mainWarnDisplaySet, + "warning: couldn't set environment variable 'DISPLAY'\n")); + perror("putenv()"); } } else if (! strcmp(argv[i], "-version")) { // print current version string printf("Blackbox %s : (c) 2001 - 2002 Sean 'Shaleh' Perry\n", - "\t\t\t 1997 - 2000 Brad Hughes\n" + "\t\t\t 1997 - 2000 Brad Hughes\n" __blackbox_version); ::exit(0);