aboutsummaryrefslogtreecommitdiff
path: root/src/Slit.cc
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2010-09-08 18:17:21 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2010-09-08 18:17:21 (GMT)
commit690d926ac444243611cd875fb84fabb4e6db2cf2 (patch)
treec8ef84056b295071f9a9207ffea5393c6cf4ad4d /src/Slit.cc
parent1e8fe2bc14856fa16508686a28a85e72cb0e422c (diff)
downloadfluxbox-690d926ac444243611cd875fb84fabb4e6db2cf2.zip
fluxbox-690d926ac444243611cd875fb84fabb4e6db2cf2.tar.bz2
introduced FbTk::BidiString
a 'BidiString' holds both the logical content and the visual reordered version of the content of a string. this helps to reduce the number of calls to reorder the string before drawing it (as introduced in the patch from Ken Bloom) and to be more consistent in menus and textboxes (drawing cursors and underlining text).
Diffstat (limited to 'src/Slit.cc')
-rw-r--r--src/Slit.cc37
1 files changed, 18 insertions, 19 deletions
diff --git a/src/Slit.cc b/src/Slit.cc
index 7aaa096..acbd922 100644
--- a/src/Slit.cc
+++ b/src/Slit.cc
@@ -169,13 +169,13 @@ namespace {
169class SlitClientMenuItem: public FbTk::MenuItem{ 169class SlitClientMenuItem: public FbTk::MenuItem{
170public: 170public:
171 explicit SlitClientMenuItem(Slit& slit, SlitClient &client, FbTk::RefCount<FbTk::Command<void> > &cmd): 171 explicit SlitClientMenuItem(Slit& slit, SlitClient &client, FbTk::RefCount<FbTk::Command<void> > &cmd):
172 FbTk::MenuItem(client.matchName().c_str(), cmd), m_slit(slit), m_client(client) { 172 FbTk::MenuItem(client.matchName(), cmd), m_slit(slit), m_client(client) {
173 setCommand(cmd); 173 setCommand(cmd);
174 FbTk::MenuItem::setSelected(client.visible()); 174 FbTk::MenuItem::setSelected(client.visible());
175 setToggleItem(true); 175 setToggleItem(true);
176 setCloseOnClick(false); 176 setCloseOnClick(false);
177 } 177 }
178 const string &label() const { 178 const FbTk::BiDiString &label() const {
179 return m_client.matchName(); 179 return m_client.matchName();
180 } 180 }
181 bool isSelected() const { 181 bool isSelected() const {
@@ -345,44 +345,44 @@ void Slit::updateStrut() {
345 return; 345 return;
346 } 346 }
347 347
348 unsigned int bw = m_slit_theme->borderWidth(); 348 const unsigned int bw = m_slit_theme->borderWidth() * 2;
349 int left = 0, right = 0, top = 0, bottom = 0; 349 int left = 0, right = 0, top = 0, bottom = 0;
350 switch (placement()) { 350 switch (placement()) {
351 case TOPLEFT: 351 case TOPLEFT:
352 top = height() + 2 * bw; 352 top = height() + bw;
353 break; 353 break;
354 case LEFTTOP: 354 case LEFTTOP:
355 left = width() + 2 * bw; 355 left = width() + bw;
356 break; 356 break;
357 case TOPCENTER: 357 case TOPCENTER:
358 top = height() + 2 * bw; 358 top = height() + bw;
359 break; 359 break;
360 case TOPRIGHT: 360 case TOPRIGHT:
361 top = height() + 2 * bw; 361 top = height() + bw;
362 break; 362 break;
363 case RIGHTTOP: 363 case RIGHTTOP:
364 right = width() + 2 * bw; 364 right = width() + bw;
365 break; 365 break;
366 case BOTTOMLEFT: 366 case BOTTOMLEFT:
367 bottom = height() + 2 * bw; 367 bottom = height() + bw;
368 break; 368 break;
369 case LEFTBOTTOM: 369 case LEFTBOTTOM:
370 left = width() + 2 * bw; 370 left = width() + bw;
371 break; 371 break;
372 case BOTTOMCENTER: 372 case BOTTOMCENTER:
373 bottom = height() + 2 * bw; 373 bottom = height() + bw;
374 break; 374 break;
375 case BOTTOMRIGHT: 375 case BOTTOMRIGHT:
376 bottom = height() + 2 * bw; 376 bottom = height() + bw;
377 break; 377 break;
378 case RIGHTBOTTOM: 378 case RIGHTBOTTOM:
379 right = width() + 2 * bw; 379 right = width() + bw;
380 break; 380 break;
381 case LEFTCENTER: 381 case LEFTCENTER:
382 left = width() + 2 * bw; 382 left = width() + bw;
383 break; 383 break;
384 case RIGHTCENTER: 384 case RIGHTCENTER:
385 right = width() + 2 * bw; 385 right = width() + bw;
386 break; 386 break;
387 } 387 }
388 388
@@ -403,14 +403,13 @@ void Slit::addClient(Window w) {
403 403
404 // Look for slot in client list by name 404 // Look for slot in client list by name
405 SlitClient *client = 0; 405 SlitClient *client = 0;
406 string match_name; 406 FbTk::FbString match_name = Xutil::getWMClassName(w);
407 match_name = Xutil::getWMClassName(w);
408 SlitClients::iterator it = m_client_list.begin(); 407 SlitClients::iterator it = m_client_list.begin();
409 SlitClients::iterator it_end = m_client_list.end(); 408 SlitClients::iterator it_end = m_client_list.end();
410 bool found_match = false; 409 bool found_match = false;
411 for (; it != it_end; ++it) { 410 for (; it != it_end; ++it) {
412 // If the name matches... 411 // If the name matches...
413 if ((*it)->matchName() == match_name) { 412 if ((*it)->matchName().logical() == match_name) {
414 // Use the slot if no window is assigned 413 // Use the slot if no window is assigned
415 if ((*it)->window() == None) { 414 if ((*it)->window() == None) {
416 client = (*it); 415 client = (*it);
@@ -1158,7 +1157,7 @@ void Slit::saveClientList() {
1158 string prevName; 1157 string prevName;
1159 string name; 1158 string name;
1160 for (; it != it_end; ++it) { 1159 for (; it != it_end; ++it) {
1161 name = (*it)->matchName(); 1160 name = (*it)->matchName().logical();
1162 if (name != prevName) 1161 if (name != prevName)
1163 file << name.c_str() << endl; 1162 file << name.c_str() << endl;
1164 1163