aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-04-03 23:04:01 (GMT)
committerfluxgen <fluxgen>2002-04-03 23:04:01 (GMT)
commit70f3639c0247c667b3ec5ddfb9e2726c08cbe12c (patch)
tree7b200998f289016804c0e1c30283d6ab935b001a /src/Window.cc
parent36dcc230a277e0bfeef05964d81e4ad56687551c (diff)
downloadfluxbox_pavel-70f3639c0247c667b3ec5ddfb9e2726c08cbe12c.zip
fluxbox_pavel-70f3639c0247c667b3ec5ddfb9e2726c08cbe12c.tar.bz2
std::string for title and icon title in FluxboxWindow
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc71
1 files changed, 21 insertions, 50 deletions
diff --git a/src/Window.cc b/src/Window.cc
index bbeb640..06c295a 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Window.cc,v 1.35 2002/03/23 15:14:45 fluxgen Exp $ 25// $Id: Window.cc,v 1.36 2002/04/03 23:01:04 fluxgen Exp $
26 26
27//use GNU extensions 27//use GNU extensions
28#ifndef _GNU_SOURCE 28#ifndef _GNU_SOURCE
@@ -152,9 +152,6 @@ tab(0)
152 152
153 client.wm_hint_flags = client.normal_hint_flags = 0; 153 client.wm_hint_flags = client.normal_hint_flags = 0;
154 client.transient_for = client.transient = 0; 154 client.transient_for = client.transient = 0;
155 client.title = 0;
156 client.title_len = 0;
157 client.icon_title = 0;
158 client.mwm_hint = (MwmHints *) 0; 155 client.mwm_hint = (MwmHints *) 0;
159 client.blackbox_hint = 0; 156 client.blackbox_hint = 0;
160 157
@@ -421,12 +418,6 @@ FluxboxWindow::~FluxboxWindow(void) {
421 if (windowmenu) 418 if (windowmenu)
422 delete windowmenu; 419 delete windowmenu;
423 420
424 if (client.title)
425 delete [] client.title;
426
427 if (client.icon_title)
428 delete [] client.icon_title;
429
430 if (tab!=0) 421 if (tab!=0)
431 delete tab; 422 delete tab;
432 tab = 0; 423 tab = 0;
@@ -1366,15 +1357,15 @@ void FluxboxWindow::reconfigure(void) {
1366 client.y = frame.y + frame.y_border + frame.mwm_border_w + 1357 client.y = frame.y + frame.y_border + frame.mwm_border_w +
1367 screen->getBorderWidth(); 1358 screen->getBorderWidth();
1368 1359
1369 if (client.title) { 1360 if (getTitle().size()>0) {
1370 if (I18n::instance()->multibyte()) { 1361 if (I18n::instance()->multibyte()) {
1371 XRectangle ink, logical; 1362 XRectangle ink, logical;
1372 XmbTextExtents(screen->getWindowStyle()->font.set, 1363 XmbTextExtents(screen->getWindowStyle()->font.set,
1373 client.title, client.title_len, &ink, &logical); 1364 getTitle().c_str(), getTitle().size(), &ink, &logical);
1374 client.title_text_w = logical.width; 1365 client.title_text_w = logical.width;
1375 } else { 1366 } else {
1376 client.title_text_w = XTextWidth(screen->getWindowStyle()->font.fontstruct, 1367 client.title_text_w = XTextWidth(screen->getWindowStyle()->font.fontstruct,
1377 client.title, client.title_len); 1368 getTitle().c_str(), getTitle().size());
1378 } 1369 }
1379 1370
1380 client.title_text_w += (frame.bevel_w * 4); 1371 client.title_text_w += (frame.bevel_w * 4);
@@ -1447,10 +1438,6 @@ void FluxboxWindow::positionWindows(void) {
1447 1438
1448 1439
1449void FluxboxWindow::getWMName(void) { 1440void FluxboxWindow::getWMName(void) {
1450 if (client.title) {
1451 delete [] client.title;
1452 client.title = 0;
1453 }
1454 1441
1455 XTextProperty text_prop; 1442 XTextProperty text_prop;
1456 char **list; 1443 char **list;
@@ -1466,44 +1453,32 @@ void FluxboxWindow::getWMName(void) {
1466 if ((XmbTextPropertyToTextList(display, &text_prop, 1453 if ((XmbTextPropertyToTextList(display, &text_prop,
1467 &list, &num) == Success) && 1454 &list, &num) == Success) &&
1468 (num > 0) && *list) { 1455 (num > 0) && *list) {
1469 client.title = StringUtil::strdup(*list); 1456 client.title = static_cast<char *>(*list);
1470 XFreeStringList(list); 1457 XFreeStringList(list);
1471 } else 1458 } else
1472 client.title = StringUtil::strdup((char *) text_prop.value); 1459 client.title = (char *)text_prop.value;
1473 1460
1474 } else 1461 } else
1475 client.title = StringUtil::strdup((char *) text_prop.value); 1462 client.title = (char *)text_prop.value;
1476
1477 XFree((char *) text_prop.value); 1463 XFree((char *) text_prop.value);
1478 } else 1464 } else
1479 client.title = StringUtil::strdup(i18n->getMessage( 1465 client.title = i18n->getMessage(
1480#ifdef NLS 1466 WindowSet, WindowUnnamed,
1481 WindowSet, WindowUnnamed, 1467 "Unnamed");
1482#else // !NLS
1483 0, 0,
1484#endif //
1485 "Unnamed"));
1486 } else { 1468 } else {
1487 client.title = StringUtil::strdup(i18n->getMessage( 1469 client.title = i18n->getMessage(
1488#ifdef NLS 1470 WindowSet, WindowUnnamed,
1489 WindowSet, WindowUnnamed, 1471 "Unnamed");
1490#else // !NLS
1491 0, 0,
1492#endif //
1493 "Unnamed"));
1494 } 1472 }
1495
1496 client.title_len = strlen(client.title);
1497 1473
1498 if (i18n->multibyte()) { 1474 if (i18n->multibyte()) {
1499 XRectangle ink, logical; 1475 XRectangle ink, logical;
1500 XmbTextExtents(screen->getWindowStyle()->font.set, 1476 XmbTextExtents(screen->getWindowStyle()->font.set,
1501 client.title, client.title_len, &ink, &logical); 1477 getTitle().c_str(), getTitle().size(), &ink, &logical);
1502 client.title_text_w = logical.width; 1478 client.title_text_w = logical.width;
1503 } else { 1479 } else {
1504 client.title_len = strlen(client.title);
1505 client.title_text_w = XTextWidth(screen->getWindowStyle()->font.fontstruct, 1480 client.title_text_w = XTextWidth(screen->getWindowStyle()->font.fontstruct,
1506 client.title, client.title_len); 1481 getTitle().c_str(), getTitle().size());
1507 } 1482 }
1508 1483
1509 client.title_text_w += (frame.bevel_w * 4); 1484 client.title_text_w += (frame.bevel_w * 4);
@@ -1511,10 +1486,6 @@ void FluxboxWindow::getWMName(void) {
1511 1486
1512 1487
1513void FluxboxWindow::getWMIconName(void) { 1488void FluxboxWindow::getWMIconName(void) {
1514 if (client.icon_title) {
1515 delete [] client.icon_title;
1516 client.icon_title = (char *) 0;
1517 }
1518 1489
1519 XTextProperty text_prop; 1490 XTextProperty text_prop;
1520 char **list; 1491 char **list;
@@ -1528,18 +1499,18 @@ void FluxboxWindow::getWMIconName(void) {
1528 if ((XmbTextPropertyToTextList(display, &text_prop, 1499 if ((XmbTextPropertyToTextList(display, &text_prop,
1529 &list, &num) == Success) && 1500 &list, &num) == Success) &&
1530 (num > 0) && *list) { 1501 (num > 0) && *list) {
1531 client.icon_title = StringUtil::strdup(*list); 1502 client.icon_title = (char *)*list;
1532 XFreeStringList(list); 1503 XFreeStringList(list);
1533 } else 1504 } else
1534 client.icon_title = StringUtil::strdup((char *) text_prop.value); 1505 client.icon_title = (char *)text_prop.value;
1535 } else 1506 } else
1536 client.icon_title = StringUtil::strdup((char *) text_prop.value); 1507 client.icon_title = (char *)text_prop.value;
1537 1508
1538 XFree((char *) text_prop.value); 1509 XFree((char *) text_prop.value);
1539 } else 1510 } else
1540 client.icon_title = StringUtil::strdup(client.title); 1511 client.icon_title = getTitle(); //assign title to icon title
1541 } else 1512 } else
1542 client.icon_title = StringUtil::strdup(client.title); 1513 client.icon_title = getTitle(); //assign title to icon title
1543} 1514}
1544 1515
1545 1516
@@ -2829,7 +2800,7 @@ void FluxboxWindow::redrawLabel(void) {
2829 DrawUtil::DrawString(display, frame.label, gc, 2800 DrawUtil::DrawString(display, frame.label, gc,
2830 &screen->getWindowStyle()->font, 2801 &screen->getWindowStyle()->font,
2831 client.title_text_w, frame.label_w, 2802 client.title_text_w, frame.label_w,
2832 frame.bevel_w, client.title); 2803 frame.bevel_w, getTitle().c_str());
2833} 2804}
2834 2805
2835 2806