all repos — fluxbox @ 68d83ecc98409b3de783b3f213951018fd258a54

custom fork of the fluxbox windowmanager

Changed Misc::
fluxgen fluxgen
commit

68d83ecc98409b3de783b3f213951018fd258a54

parent

ad3923a371d8f64a506cbaacb170a911be73093a

M src/Basemenu.ccsrc/Basemenu.cc

@@ -33,6 +33,7 @@ #include "i18n.hh"

#include "fluxbox.hh" #include "Basemenu.hh" #include "Screen.hh" +#include "StringUtil.hh" #ifdef HAVE_STDIO_H # include <stdio.h>

@@ -197,8 +198,8 @@

int Basemenu::insert(const char *l, int function, const char *e, int pos) { char *label = 0, *exec = 0; - if (l) label = Misc::strdup(l); - if (e) exec = Misc::strdup(e); + if (l) label = StringUtil::strdup(l); + if (e) exec = StringUtil::strdup(e); BasemenuItem *item = new BasemenuItem(label, function, exec); menuitems->insert(item, pos);

@@ -210,7 +211,7 @@

int Basemenu::insert(const char *l, Basemenu *submenu, int pos) { char *label = 0; - if (l) label = Misc::strdup(l); + if (l) label = StringUtil::strdup(l); BasemenuItem *item = new BasemenuItem(label, submenu); menuitems->insert(item, pos);

@@ -507,11 +508,11 @@

l += (menu.bevel_w * 2); switch (screen->getMenuStyle()->titlefont.justify) { - case Misc::Font::RIGHT: + case DrawUtil::Font::RIGHT: dx += menu.width - l; break; - case Misc::Font::CENTER: + case DrawUtil::Font::CENTER: dx += (menu.width - l) / 2; break; default:

@@ -644,11 +645,11 @@ (menu.bevel_w / 2);

} switch(screen->getMenuStyle()->framefont.justify) { - case Misc::Font::LEFT: + case DrawUtil::Font::LEFT: text_x = item_x + menu.bevel_w + menu.item_h + 1; break; - case Misc::Font::RIGHT: + case DrawUtil::Font::RIGHT: text_x = item_x + menu.item_w - (menu.item_h + menu.bevel_w + text_w); break; default: //center

@@ -789,7 +790,7 @@ void Basemenu::setLabel(const char *l) {

if (menu.label) delete [] menu.label; - if (l) menu.label = Misc::strdup(l); + if (l) menu.label = StringUtil::strdup(l); else menu.label = 0; }
M src/IconBar.ccsrc/IconBar.cc

@@ -273,10 +273,10 @@ break;

} switch (m_screen->getWindowStyle()->tab.font.justify) { - case Misc::Font::RIGHT: + case DrawUtil::Font::RIGHT: dx += width - l; break; - case Misc::Font::CENTER: + case DrawUtil::Font::CENTER: dx += (width - l) / 2; break; default:
M src/Screen.ccsrc/Screen.cc

@@ -39,6 +39,7 @@ #include "Clientmenu.hh"

#include "Icon.hh" #include "Image.hh" #include "Screen.hh" +#include "StringUtil.hh" #ifdef SLIT #include "Slit.hh"

@@ -831,13 +832,13 @@ void BScreen::saveStrftimeFormat(char *format) {

if (resource.strftime_format) delete [] resource.strftime_format; - resource.strftime_format = Misc::strdup(format); + resource.strftime_format = StringUtil::strdup(format); } #endif // HAVE_STRFTIME void BScreen::addWorkspaceName(char *name) { - workspaceNames->insert(Misc::strdup(name)); + workspaceNames->insert(StringUtil::strdup(name)); }

@@ -847,7 +848,7 @@ if (id >= 0 && id < workspaceNames->count()) {

char *wkspc_name = workspaceNames->find(id); if (wkspc_name) - *name = Misc::strdup(wkspc_name); + *name = StringUtil::strdup(wkspc_name); } else *name = 0; }

@@ -1460,7 +1461,7 @@

char **ls = new char* [entries]; int index = 0; while ((p = readdir(d))) - ls[index++] = Misc::strdup(p->d_name); + ls[index++] = StringUtil::strdup(p->d_name); qsort(ls, entries, sizeof(char *), dcmp);
M src/Tab.ccsrc/Tab.cc

@@ -20,14 +20,15 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER

// DEALINGS IN THE SOFTWARE. #include "Tab.hh" -#include <iostream> + #ifdef HAVE_CONFIG_H # include "../config.h" #endif // HAVE_CONFIG_H + #include "i18n.hh" +#include "DrawUtil.hh" -#include "misc.hh" - +#include <iostream> using namespace std; bool Tab::m_stoptabs = false;

@@ -333,11 +334,11 @@ if ((m_win->getScreen()->getTabPlacement() == PLEFT ||

m_win->getScreen()->getTabPlacement() == PRIGHT) && (!m_win->isShaded() && m_win->getScreen()->isTabRotateVertical())) { - tabtext_w = Misc::XRotTextWidth(m_win->getScreen()->getWindowStyle()->tab.rot_font, + tabtext_w = DrawUtil::XRotTextWidth(m_win->getScreen()->getWindowStyle()->tab.rot_font, m_win->client.title, m_win->client.title_len); tabtext_w += (m_win->frame.bevel_w * 4); - Misc::DrawRotString(m_display, m_tabwin, gc, + DrawUtil::DrawRotString(m_display, m_tabwin, gc, m_win->getScreen()->getWindowStyle()->tab.rot_font, m_win->getScreen()->getWindowStyle()->tab.font.justify, tabtext_w, m_size_w, m_size_h,

@@ -357,7 +358,7 @@ m_win->client.title, m_win->client.title_len);

} tabtext_w += (m_win->frame.bevel_w * 4); - Misc::DrawString(m_display, m_tabwin, gc, + DrawUtil::DrawString(m_display, m_tabwin, gc, &m_win->getScreen()->getWindowStyle()->tab.font, tabtext_w, m_size_w, m_win->frame.bevel_w, m_win->client.title);
M src/Theme.ccsrc/Theme.cc

@@ -270,7 +270,7 @@ if (m_windowstyle.tab.font.fontstruct)

XFreeFont(m_display, m_windowstyle.tab.font.fontstruct); if (m_windowstyle.tab.rot_font) - Misc::XRotUnloadFont(m_display, m_windowstyle.tab.rot_font); + DrawUtil::XRotUnloadFont(m_display, m_windowstyle.tab.rot_font); XFreeGC(m_display, m_windowstyle.tab.l_text_focus_gc);

@@ -345,27 +345,27 @@ if (XrmGetResource(m_database, "menu.title.justify",

"Menu.Title.Justify", &value_type, &value)) { if (strstr(value.addr, "right") || strstr(value.addr, "Right")) - m_menustyle.titlefont.justify = Misc::Font::RIGHT; + m_menustyle.titlefont.justify = DrawUtil::Font::RIGHT; else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) - m_menustyle.titlefont.justify = Misc::Font::CENTER; + m_menustyle.titlefont.justify = DrawUtil::Font::CENTER; else - m_menustyle.titlefont.justify = Misc::Font::LEFT; + m_menustyle.titlefont.justify = DrawUtil::Font::LEFT; } else - m_menustyle.titlefont.justify = Misc::Font::LEFT; + m_menustyle.titlefont.justify = DrawUtil::Font::LEFT; if (XrmGetResource(m_database, "menu.frame.justify", "Menu.Frame.Justify", &value_type, &value)) { if (strstr(value.addr, "right") || strstr(value.addr, "Right")) - m_menustyle.framefont.justify = Misc::Font::RIGHT; + m_menustyle.framefont.justify = DrawUtil::Font::RIGHT; else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) - m_menustyle.framefont.justify = Misc::Font::CENTER; + m_menustyle.framefont.justify = DrawUtil::Font::CENTER; else - m_menustyle.framefont.justify = Misc::Font::LEFT; + m_menustyle.framefont.justify = DrawUtil::Font::LEFT; } else - m_menustyle.framefont.justify = Misc::Font::LEFT; + m_menustyle.framefont.justify = DrawUtil::Font::LEFT; if (XrmGetResource(m_database, "menu.bullet", "Menu.Bullet", &value_type, &value)) {

@@ -500,13 +500,13 @@

if (XrmGetResource(m_database, "window.justify", "Window.Justify", &value_type, &value)) { if (strstr(value.addr, "right") || strstr(value.addr, "Right")) - m_windowstyle.font.justify = Misc::Font::RIGHT; + m_windowstyle.font.justify = DrawUtil::Font::RIGHT; else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) - m_windowstyle.font.justify = Misc::Font::CENTER; + m_windowstyle.font.justify = DrawUtil::Font::CENTER; else - m_windowstyle.font.justify = Misc::Font::LEFT; + m_windowstyle.font.justify = DrawUtil::Font::LEFT; } else - m_windowstyle.font.justify = Misc::Font::LEFT; + m_windowstyle.font.justify = DrawUtil::Font::LEFT; }

@@ -578,21 +578,21 @@ //--------- rotated font for left and right tabs

// TODO: add extra checking if (XrmGetResource(m_database, "window.tab.font", "Window.Tab.Font", &value_type, &value)) { - if (! (m_windowstyle.tab.rot_font = Misc::XRotLoadFont(m_display, value.addr, 90.0)) ) - m_windowstyle.tab.rot_font = Misc::XRotLoadFont(m_display, "fixed", 90); + if (! (m_windowstyle.tab.rot_font = DrawUtil::XRotLoadFont(m_display, value.addr, 90.0)) ) + m_windowstyle.tab.rot_font = DrawUtil::XRotLoadFont(m_display, "fixed", 90); } else - m_windowstyle.tab.rot_font = Misc::XRotLoadFont(m_display, "fixed", 90); + m_windowstyle.tab.rot_font = DrawUtil::XRotLoadFont(m_display, "fixed", 90); if (XrmGetResource(m_database, "window.tab.justify", "Window.Tab.Justify", &value_type, &value)) { if (strstr(value.addr, "right") || strstr(value.addr, "Right")) - m_windowstyle.tab.font.justify = Misc::Font::RIGHT; + m_windowstyle.tab.font.justify = DrawUtil::Font::RIGHT; else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) - m_windowstyle.tab.font.justify = Misc::Font::CENTER; + m_windowstyle.tab.font.justify = DrawUtil::Font::CENTER; else - m_windowstyle.tab.font.justify = Misc::Font::LEFT; + m_windowstyle.tab.font.justify = DrawUtil::Font::LEFT; } else - m_windowstyle.tab.font.justify = Misc::Font::LEFT; + m_windowstyle.tab.font.justify = DrawUtil::Font::LEFT; }

@@ -649,13 +649,13 @@

if (XrmGetResource(m_database, "toolbar.justify", "Toolbar.Justify", &value_type, &value)) { if (strstr(value.addr, "right") || strstr(value.addr, "Right")) - m_toolbarstyle.font.justify = Misc::Font::RIGHT; + m_toolbarstyle.font.justify = DrawUtil::Font::RIGHT; else if (strstr(value.addr, "center") || strstr(value.addr, "Center")) - m_toolbarstyle.font.justify = Misc::Font::CENTER; + m_toolbarstyle.font.justify = DrawUtil::Font::CENTER; else - m_toolbarstyle.font.justify = Misc::Font::LEFT; + m_toolbarstyle.font.justify = DrawUtil::Font::LEFT; } else - m_toolbarstyle.font.justify = Misc::Font::LEFT; + m_toolbarstyle.font.justify = DrawUtil::Font::LEFT; }
M src/Theme.hhsrc/Theme.hh

@@ -50,8 +50,8 @@ #ifndef _IMAGE_HH_

#include "Image.hh" #endif //_IMAGE_HH_ -#ifndef _MISC_HH_ -#include "misc.hh" +#ifndef _DRAWUTIL_HH_ +#include "DrawUtil.hh" #endif //_MISC_HH_ #include <X11/Xlib.h>

@@ -70,7 +70,7 @@ typedef struct MenuStyle {

BColor t_text, f_text, h_text, d_text; BTexture title, frame, hilite; GC t_text_gc, f_text_gc, h_text_gc, d_text_gc, hilite_gc; - Misc::Font titlefont, framefont; + DrawUtil::Font titlefont, framefont; int bullet, bullet_pos; } MenuStyle;

@@ -79,7 +79,7 @@ {

BTexture l_focus, l_unfocus, t_focus, t_unfocus; GC l_text_focus_gc, l_text_unfocus_gc; - Misc::Font font; + DrawUtil::Font font; BColor l_text_focus, l_text_unfocus; } LabelStyle;

@@ -95,7 +95,7 @@ struct t_tab:public LabelStyle {

BColor border_color; unsigned int border_width; unsigned int border_width_2x; - Misc::XRotFontStruct *rot_font; + DrawUtil::XRotFontStruct *rot_font; } tab; } WindowStyle;

@@ -105,7 +105,7 @@ typedef struct ToolbarStyle {

BColor l_text, w_text, c_text, b_pic; BTexture toolbar, label, window, button, pressed, clock; GC l_text_gc, w_text_gc, c_text_gc, b_pic_gc; - Misc::Font font; + DrawUtil::Font font; } ToolbarStyle;
M src/Toolbar.ccsrc/Toolbar.cc

@@ -63,7 +63,6 @@ # endif // HAVE_SYS_TIME_H

#endif // TIME_WITH_SYS_TIME #include <iostream> -#include "misc.hh" using namespace std;

@@ -645,11 +644,11 @@

} switch (screen->getToolbarStyle()->font.justify) { - case Misc::Font::RIGHT: + case DrawUtil::Font::RIGHT: dx += frame.clock_w - l; break; - case Misc::Font::CENTER: + case DrawUtil::Font::CENTER: dx += (frame.clock_w - l) / 2; break; default: //LEFT

@@ -711,11 +710,11 @@ break;

} } switch (screen->getToolbarStyle()->font.justify) { - case Misc::Font::RIGHT: + case DrawUtil::Font::RIGHT: dx += frame.window_label_w - l; break; - case Misc::Font::CENTER: + case DrawUtil::Font::CENTER: dx += (frame.window_label_w - l) / 2; break; default:

@@ -789,11 +788,11 @@ }

} switch (screen->getToolbarStyle()->font.justify) { - case Misc::Font::RIGHT: + case DrawUtil::Font::RIGHT: dx += frame.workspace_label_w - l; break; - case Misc::Font::CENTER: + case DrawUtil::Font::CENTER: dx += (frame.workspace_label_w - l) / 2; break; default:
M src/Window.ccsrc/Window.cc

@@ -41,6 +41,7 @@ #include "Window.hh"

#include "Windowmenu.hh" #include "Workspace.hh" #include "misc.hh" +#include "StringUtil.hh" #ifdef SLIT # include "Slit.hh"

@@ -1201,17 +1202,17 @@

if ((XmbTextPropertyToTextList(display, &text_prop, &list, &num) == Success) && (num > 0) && *list) { - client.title = Misc::strdup(*list); + client.title = StringUtil::strdup(*list); XFreeStringList(list); } else - client.title = Misc::strdup((char *) text_prop.value); + client.title = StringUtil::strdup((char *) text_prop.value); } else - client.title = Misc::strdup((char *) text_prop.value); + client.title = StringUtil::strdup((char *) text_prop.value); XFree((char *) text_prop.value); } else - client.title = Misc::strdup(i18n->getMessage( + client.title = StringUtil::strdup(i18n->getMessage( #ifdef NLS WindowSet, WindowUnnamed, #else // !NLS

@@ -1219,7 +1220,7 @@ 0, 0,

#endif // "Unnamed")); } else { - client.title = Misc::strdup(i18n->getMessage( + client.title = StringUtil::strdup(i18n->getMessage( #ifdef NLS WindowSet, WindowUnnamed, #else // !NLS

@@ -1263,18 +1264,18 @@

if ((XmbTextPropertyToTextList(display, &text_prop, &list, &num) == Success) && (num > 0) && *list) { - client.icon_title = Misc::strdup(*list); + client.icon_title = StringUtil::strdup(*list); XFreeStringList(list); } else - client.icon_title = Misc::strdup((char *) text_prop.value); + client.icon_title = StringUtil::strdup((char *) text_prop.value); } else - client.icon_title = Misc::strdup((char *) text_prop.value); + client.icon_title = StringUtil::strdup((char *) text_prop.value); XFree((char *) text_prop.value); } else - client.icon_title = Misc::strdup(client.title); + client.icon_title = StringUtil::strdup(client.title); } else - client.icon_title = Misc::strdup(client.title); + client.icon_title = StringUtil::strdup(client.title); }

@@ -2416,7 +2417,7 @@

GC gc = ((focused) ? screen->getWindowStyle()->l_text_focus_gc : screen->getWindowStyle()->l_text_unfocus_gc); - Misc::DrawString(display, frame.label, gc, + DrawUtil::DrawString(display, frame.label, gc, &screen->getWindowStyle()->font, client.title_text_w, frame.label_w, frame.bevel_w, client.title);
M src/Workspace.ccsrc/Workspace.cc

@@ -40,6 +40,7 @@ #include "Toolbar.hh"

#include "Window.hh" #include "Workspace.hh" #include "Windowmenu.hh" +#include "StringUtil.hh" #ifdef HAVE_STDIO_H # include <stdio.h>

@@ -48,10 +49,6 @@

#ifdef STDC_HEADERS # include <string.h> #endif // STDC_HEADERS - -#define MIN(x,y) ((x < y) ? x : y) -#define MAX(x,y) ((x > y) ? x : y) - Workspace::Workspace(BScreen *scrn, int i) { screen = scrn;

@@ -309,7 +306,7 @@ if (name)

delete [] name; if (new_name) { - name = Misc::strdup(new_name); + name = StringUtil::strdup(new_name); } else { name = new char[128]; sprintf(name, I18n::instance()->
M src/fluxbox.ccsrc/fluxbox.cc

@@ -32,16 +32,6 @@ #ifdef HAVE_CONFIG_H

# include "../config.h" #endif // HAVE_CONFIG_H -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <X11/Xresource.h> -#include <X11/Xatom.h> -#include <X11/keysym.h> - -#ifdef SHAPE -#include <X11/extensions/shape.h> -#endif // SHAPE - #include "i18n.hh" #include "fluxbox.hh" #include "Basemenu.hh"

@@ -57,6 +47,18 @@ #include "Toolbar.hh"

#include "Window.hh" #include "Workspace.hh" #include "Workspacemenu.hh" +#include "StringUtil.hh" + +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/Xresource.h> +#include <X11/Xatom.h> +#include <X11/keysym.h> + +#ifdef SHAPE +#include <X11/extensions/shape.h> +#endif // SHAPE + #ifdef HAVE_STDIO_H # include <stdio.h>

@@ -1699,7 +1701,7 @@ dbfile = new char[dbfile_size];

snprintf(dbfile, dbfile_size, "%s/.%s/%s", homedir, RC_PATH, RC_INIT_FILE); } else - dbfile = Misc::strdup(rc_file); + dbfile = StringUtil::strdup(rc_file); return dbfile; }

@@ -1731,9 +1733,9 @@ //get menu filename

if (XrmGetResource(database, "session.menuFile", "Session.MenuFile", &value_type, &value)) { - resource.menu_file = Misc::expandFilename(value.addr); // expand ~ to $HOME + resource.menu_file = StringUtil::expandFilename(value.addr); // expand ~ to $HOME } else - resource.menu_file = Misc::strdup(DEFAULTMENU); + resource.menu_file = StringUtil::strdup(DEFAULTMENU); if (resource.titlebar_file) { delete resource.titlebar_file;

@@ -1743,9 +1745,9 @@

//get titlebar filename if (XrmGetResource(database, "session.titlebarFile", "Session.TitlebarFile", &value_type, &value)) { - resource.titlebar_file = Misc::expandFilename(value.addr); //expand ~ to home + resource.titlebar_file = StringUtil::expandFilename(value.addr); //expand ~ to home } else - resource.titlebar_file = Misc::strdup(DEFAULTTITLEBAR); + resource.titlebar_file = StringUtil::strdup(DEFAULTTITLEBAR); //if already allocated memory for keys_file destroy it if (resource.keys_file) {

@@ -1756,9 +1758,9 @@

//get keys filename if (XrmGetResource(database, "session.keyFile", "Session.keyFile", &value_type, &value)) { - resource.keys_file = Misc::expandFilename(value.addr); //expand ~ to home + resource.keys_file = StringUtil::expandFilename(value.addr); //expand ~ to home } else - resource.keys_file = Misc::strdup(DEFAULTKEYSFILE); + resource.keys_file = StringUtil::strdup(DEFAULTKEYSFILE); if (XrmGetResource(database, "session.iconbar", "Session.Iconbar",

@@ -1797,9 +1799,9 @@ delete [] resource.style_file;

if (XrmGetResource(database, "session.styleFile", "Session.StyleFile", &value_type, &value)) - resource.style_file = Misc::expandFilename(value.addr); + resource.style_file = StringUtil::expandFilename(value.addr); else - resource.style_file = Misc::strdup(DEFAULTSTYLE); + resource.style_file = StringUtil::strdup(DEFAULTSTYLE); if (resource.root_cmd) { delete [] resource.root_cmd;

@@ -1807,7 +1809,7 @@ resource.root_cmd = 0;

} if (XrmGetResource(database, "session.rootCommand", "Session.RootCommand", &value_type, &value)) - resource.root_cmd = Misc::expandFilename(value.addr); + resource.root_cmd = StringUtil::expandFilename(value.addr); else resource.root_cmd = 0;

@@ -2058,7 +2060,7 @@ 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)) { - char *search = Misc::strdup(value.addr); + char *search = StringUtil::strdup(value.addr); int i; for (i = 0; i < screen->getNumberOfWorkspaces(); i++) {

@@ -2504,7 +2506,7 @@ void Fluxbox::saveStyleFilename(const char *filename) {

if (resource.style_file) delete [] resource.style_file; - resource.style_file = Misc::strdup(filename); + resource.style_file = StringUtil::strdup(filename); }

@@ -2521,7 +2523,7 @@

if (! stat(filename, &buf)) { MenuTimestamp *ts = new MenuTimestamp; - ts->filename = Misc::strdup(filename); + ts->filename = StringUtil::strdup(filename); ts->timestamp = buf.st_ctime; menuTimestamps->insert(ts);