[openbox] No UTF in WorkspaceSelector
Horst Gutmann
hgutmann at edu.uni-klu.ac.at
Sat Feb 8 04:48:51 EST 2003
Sry, am not that familiar with patching.
from the openbox root directory patch -p1 < ../utf8fix.patch
right?
smoynes at nexus.carleton.ca wrote:
>* Horst Gutmann (hgutmann at edu.uni-klu.ac.at) wrote:
>
>
>>I'm not sure if this is a bug or if I just missed the option for
>>enabling it, that's why I didn't report it as bug.
>>The WorkspaceSelector (MidClick on Desktop) doesn't include UTF'd text
>>but the WindowTitle does.
>>
>>Version: 2.3.0
>>
>>
>
>Attached is a patch that should fix this. Could you test it and report
>any difficulties?
>
>s.
>
>
>------------------------------------------------------------------------
>
>? utf8fix.patch
>Index: Basemenu.cc
>===================================================================
>RCS file: /cvs/cvsroot/openbox/src/Attic/Basemenu.cc,v
>retrieving revision 1.32.4.4
>diff -p -u -r1.32.4.4 Basemenu.cc
>--- Basemenu.cc 2003/01/11 20:37:49 1.32.4.4
>+++ Basemenu.cc 2003/02/08 06:29:51
>@@ -209,9 +209,9 @@ int Basemenu::insert(BasemenuItem *item,
> }
>
>
>-int Basemenu::insert(const string& label, int function,
>+int Basemenu::insert(const string& label, bool utf, int function,
> const string& exec, int pos) {
>- BasemenuItem *item = new BasemenuItem(label, function, exec);
>+ BasemenuItem *item = new BasemenuItem(label, utf, function, exec);
> return insert(item, pos);
> }
>
>@@ -267,7 +267,7 @@ void Basemenu::update(void) {
> unsigned int ii = 0;
> MenuItems::iterator it = menuitems.begin(), end = menuitems.end();
> for (; it != end; ++it) {
>- ii = screen->getMenuStyle()->f_font->measureString((*it)->l, false) +
>+ ii = screen->getMenuStyle()->f_font->measureString((*it)->l, (*it)->utf) +
> (menu.bevel_w * 2) + (menu.item_h * 2);
>
> menu.item_w = ((menu.item_w < ii) ? ii : menu.item_w);
>@@ -533,6 +533,7 @@ void Basemenu::drawItem(int index, bool
>
> bool dotext = True, dohilite = True, dosel = True, dooppsel = True;
> const char *text = item->label();
>+ const bool utf = item->getUTF();
> const int sbl = index / menu.persub, i = index - (sbl * menu.persub);
> const unsigned int half_w = menu.item_h / 2, quarter_w = menu.item_h / 4;
> int item_x = (sbl * menu.item_w), item_y = (i * menu.item_h);
>@@ -542,7 +543,7 @@ void Basemenu::drawItem(int index, bool
> text_h = 0;
>
> if (text) {
>- text_w = screen->getMenuStyle()->f_font->measureString(text, false);
>+ text_w = screen->getMenuStyle()->f_font->measureString(text, utf);
> text_y = item_y + menu.bevel_w / 2;
>
> switch(screen->getMenuStyle()->f_justify) {
>@@ -678,7 +679,7 @@ void Basemenu::drawItem(int index, bool
> (highlight ? style->h_text :
> (item->isEnabled() ? style->f_text :
> style->d_text)),
>- text, false);
>+ text, utf);
> }
>
> if (dosel && item->submenu()) {
>Index: Basemenu.hh
>===================================================================
>RCS file: /cvs/cvsroot/openbox/src/Attic/Basemenu.hh,v
>retrieving revision 1.6.8.1
>diff -p -u -r1.6.8.1 Basemenu.hh
>--- Basemenu.hh 2003/01/03 20:47:09 1.6.8.1
>+++ Basemenu.hh 2003/02/08 06:29:52
>@@ -95,9 +95,10 @@ public:
> inline const char *getLabel(void) const { return menu.label.c_str(); }
>
> int insert(BasemenuItem *item, int pos);
>- int insert(const std::string& label, int function = 0,
>+ int insert(const std::string& label, bool utf, int function = 0,
> const std::string& exec = "", int pos = -1);
>- int insert(const std::string &label, Basemenu *submenu, int pos = -1);
>+ int insert(const std::string &label, Basemenu *submenu,
>+ int pos = -1);
> int remove(int index);
>
> void changeItemLabel(unsigned int index, const std::string& label);
>@@ -150,6 +151,7 @@ class BasemenuItem {
> private:
> Basemenu *sub;
> std::string l, e;
>+ bool utf;
> int f, enabled, selected;
>
> friend class Basemenu;
>@@ -157,10 +159,12 @@ private:
> protected:
>
> public:
>- BasemenuItem(const std::string& lp, int fp = 0, const std::string& ep = ""):
>- sub(0), l(lp), e(ep), f(fp), enabled(1), selected(0) {}
>+ BasemenuItem(const std::string& lp, bool u, int fp = 0,
>+ const std::string& ep = ""):
>+ sub(0), l(lp), e(ep), utf(u), f(fp), enabled(1), selected(0) {}
>
> BasemenuItem(const std::string& lp, Basemenu *mp): sub(mp), l(lp),
>+ utf(false),
> f(0), enabled(1),
> selected(0) {}
>
>@@ -175,6 +179,7 @@ public:
> inline void setEnabled(int e) { enabled = e; }
> inline int isSelected(void) const { return selected; }
> inline void setSelected(int s) { selected = s; }
>+ inline bool getUTF(void) { return utf; }
> };
>
>
>Index: Screen.cc
>===================================================================
>RCS file: /cvs/cvsroot/openbox/src/Attic/Screen.cc,v
>retrieving revision 1.147.2.11
>diff -p -u -r1.147.2.11 Screen.cc
>--- Screen.cc 2003/01/31 17:44:11 1.147.2.11
>+++ Screen.cc 2003/02/08 06:29:56
>@@ -1300,7 +1300,7 @@ void BScreen::addIcon(BlackboxWindow *w)
> iconList.push_back(w);
>
> const char* title = w->getIconTitle();
>- iconmenu->insert(title);
>+ iconmenu->insert(title, w->getIconTitleUtf());
> iconmenu->update();
> }
>
>@@ -2044,11 +2044,14 @@ void BScreen::InitMenu(void) {
> if (defaultMenu) {
> rootmenu->setInternalMenu();
> rootmenu->insert(i18n(ScreenSet, Screenxterm, "xterm"),
>+ false,
> BScreen::Execute,
> i18n(ScreenSet, Screenxterm, "xterm"));
> rootmenu->insert(i18n(ScreenSet, ScreenRestart, "Restart"),
>+ false,
> BScreen::Restart);
> rootmenu->insert(i18n(ScreenSet, ScreenExit, "Exit"),
>+ false,
> BScreen::Exit);
> rootmenu->setLabel(i18n(BasemenuSet, BasemenuBlackboxMenu,
> "Openbox Menu"));
>@@ -2129,7 +2132,7 @@ bool BScreen::parseMenuFile(FILE *file,
> case 'n'+'o'+'p': // nop
> if (! *label)
> label[0] = '\0';
>- menu->insert(label);
>+ menu->insert(label, false);
>
> break;
>
>@@ -2141,7 +2144,7 @@ bool BScreen::parseMenuFile(FILE *file,
> continue;
> }
>
>- menu->insert(label, BScreen::Execute, command);
>+ menu->insert(label, false, BScreen::Execute, command);
>
> break;
>
>@@ -2153,7 +2156,7 @@ bool BScreen::parseMenuFile(FILE *file,
> continue;
> }
>
>- menu->insert(label, BScreen::Exit);
>+ menu->insert(label, false, BScreen::Exit);
>
> break;
>
>@@ -2168,7 +2171,7 @@ bool BScreen::parseMenuFile(FILE *file,
>
> string style = expandTilde(command);
>
>- menu->insert(label, BScreen::SetStyle, style.c_str());
>+ menu->insert(label, false, BScreen::SetStyle, style.c_str());
> }
> break;
>
>@@ -2252,9 +2255,9 @@ bool BScreen::parseMenuFile(FILE *file,
> }
>
> if (*command)
>- menu->insert(label, BScreen::RestartOther, command);
>+ menu->insert(label, false, BScreen::RestartOther, command);
> else
>- menu->insert(label, BScreen::Restart);
>+ menu->insert(label, false, BScreen::Restart);
> }
>
> break;
>@@ -2268,7 +2271,7 @@ bool BScreen::parseMenuFile(FILE *file,
> continue;
> }
>
>- menu->insert(label, BScreen::Reconfigure);
>+ menu->insert(label, false, BScreen::Reconfigure);
> }
>
> break;
>@@ -2339,7 +2342,7 @@ bool BScreen::parseMenuFile(FILE *file,
> style += fname;
>
> if (! stat(style.c_str(), &statbuf) && S_ISREG(statbuf.st_mode))
>- stylesmenu->insert(fname, BScreen::SetStyle, style);
>+ stylesmenu->insert(fname, false, BScreen::SetStyle, style);
> }
>
> stylesmenu->update();
>Index: Slit.cc
>===================================================================
>RCS file: /cvs/cvsroot/openbox/src/Attic/Slit.cc,v
>retrieving revision 1.33
>diff -p -u -r1.33 Slit.cc
>--- Slit.cc 2002/07/26 08:37:15 1.33
>+++ Slit.cc 2003/02/08 06:29:57
>@@ -848,7 +848,7 @@ Slitmenu::Placementmenu::Placementmenu(S
> Slit::BottomLeft);
> insert(i18n(CommonSet, CommonPlacementTopCenter, "Top Center"),
> Slit::TopCenter);
>- insert("");
>+ insert("", false);
> insert(i18n(CommonSet, CommonPlacementBottomCenter, "Bottom Center"),
> Slit::BottomCenter);
> insert(i18n(CommonSet, CommonPlacementTopRight, "Top Right"),
>Index: Windowmenu.cc
>===================================================================
>RCS file: /cvs/cvsroot/openbox/src/Attic/Windowmenu.cc,v
>retrieving revision 1.12
>diff -p -u -r1.12 Windowmenu.cc
>--- Windowmenu.cc 2002/08/20 15:38:49 1.12
>+++ Windowmenu.cc 2003/02/08 06:30:04
>@@ -189,7 +189,7 @@ void Windowmenu::SendtoWorkspacemenu::up
>
> for (i = 0; i < workspace_count; ++i) {
> if (r < workspace_count) {
>- insert(getScreen()->getWorkspace(i)->getName());
>+ insert(getScreen()->getWorkspace(i)->getName(), false);
> ++r;
> } else {
> changeItemLabel(i, getScreen()->getWorkspace(i)->getName());
>Index: Workspace.cc
>===================================================================
>RCS file: /cvs/cvsroot/openbox/src/Attic/Workspace.cc,v
>retrieving revision 1.95
>diff -p -u -r1.95 Workspace.cc
>--- Workspace.cc 2002/10/01 01:59:09 1.95
>+++ Workspace.cc 2003/02/08 06:30:05
>@@ -100,7 +100,7 @@ void Workspace::addWindow(BlackboxWindow
>
> windowList.push_back(w);
>
>- clientmenu->insert(w->getTitle());
>+ clientmenu->insert(w->getTitle(), w->getTitleUtf());
> clientmenu->update();
>
> if (! sticky)
>Index: Workspacemenu.cc
>===================================================================
>RCS file: /cvs/cvsroot/openbox/src/Attic/Workspacemenu.cc,v
>retrieving revision 1.6
>diff -p -u -r1.6 Workspacemenu.cc
>--- Workspacemenu.cc 2002/07/14 20:54:03 1.6
>+++ Workspacemenu.cc 2003/02/08 06:30:05
>@@ -38,8 +38,8 @@ Workspacemenu::Workspacemenu(BScreen *sc
> setInternalMenu();
>
> setLabel(i18n(WorkspacemenuSet, WorkspacemenuWorkspacesTitle, "Workspaces"));
>- insert(i18n(WorkspacemenuSet, WorkspacemenuNewWorkspace, "New Workspace"));
>- insert(i18n(WorkspacemenuSet, WorkspacemenuRemoveLast, "Remove Last"));
>+ insert(i18n(WorkspacemenuSet, WorkspacemenuNewWorkspace, "New Workspace"), false);
>+ insert(i18n(WorkspacemenuSet, WorkspacemenuRemoveLast, "Remove Last"), false);
> }
>
>
>
>
More information about the openbox
mailing list