diff options
Diffstat (limited to 'src/Screen.cc')
-rw-r--r-- | src/Screen.cc | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/Screen.cc b/src/Screen.cc index 1edcd93..9c0182b 100644 --- a/src/Screen.cc +++ b/src/Screen.cc | |||
@@ -361,13 +361,12 @@ BScreen::BScreen(FbTk::ResourceManager &rm, | |||
361 | m_configmenu->setInternalMenu(); | 361 | m_configmenu->setInternalMenu(); |
362 | 362 | ||
363 | // check which desktop we should start on | 363 | // check which desktop we should start on |
364 | unsigned int first_desktop = 0; | 364 | int first_desktop = 0; |
365 | if (m_restart) { | 365 | if (m_restart) { |
366 | bool exists; | 366 | bool exists; |
367 | unsigned int ret=static_cast<unsigned int>(rootWindow().cardinalProperty(atom_net_desktop, &exists)); | 367 | int ret = (rootWindow().cardinalProperty(atom_net_desktop, &exists)); |
368 | if (exists) { | 368 | if (exists) { |
369 | if (ret < static_cast<unsigned int>(nr_ws)) | 369 | first_desktop = FbTk::Util::clamp<int>(ret, 0, nr_ws); |
370 | first_desktop = ret; | ||
371 | } | 370 | } |
372 | } | 371 | } |
373 | 372 | ||
@@ -1431,7 +1430,7 @@ void BScreen::showPosition(int x, int y) { | |||
1431 | return; | 1430 | return; |
1432 | 1431 | ||
1433 | char buf[256]; | 1432 | char buf[256]; |
1434 | sprintf(buf, "X:%5d x Y:%5d", x, y); | 1433 | snprintf(buf, sizeof(buf), "X:%5d x Y:%5d", x, y); |
1435 | 1434 | ||
1436 | FbTk::BiDiString label(buf); | 1435 | FbTk::BiDiString label(buf); |
1437 | m_pos_window->showText(label); | 1436 | m_pos_window->showText(label); |
@@ -1449,7 +1448,7 @@ void BScreen::showGeometry(unsigned int gx, unsigned int gy) { | |||
1449 | char buf[256]; | 1448 | char buf[256]; |
1450 | _FB_USES_NLS; | 1449 | _FB_USES_NLS; |
1451 | 1450 | ||
1452 | sprintf(buf, | 1451 | snprintf(buf, sizeof(buf), |
1453 | _FB_XTEXT(Screen, GeometryFormat, | 1452 | _FB_XTEXT(Screen, GeometryFormat, |
1454 | "W: %4d x H: %4d", | 1453 | "W: %4d x H: %4d", |
1455 | "Format for width and height window, %4d for width, and %4d for height").c_str(), | 1454 | "Format for width and height window, %4d for width, and %4d for height").c_str(), |
@@ -1518,7 +1517,7 @@ void BScreen::renderGeomWindow() { | |||
1518 | 1517 | ||
1519 | const std::string msg = _FB_XTEXT(Screen, GeometrySpacing, | 1518 | const std::string msg = _FB_XTEXT(Screen, GeometrySpacing, |
1520 | "W: %04d x H: %04d", "Representative maximum sized text for width and height dialog"); | 1519 | "W: %04d x H: %04d", "Representative maximum sized text for width and height dialog"); |
1521 | const int n = snprintf(buf, msg.size(), msg.c_str(), 0, 0); | 1520 | const int n = snprintf(buf, sizeof(buf), msg.c_str(), 0, 0); |
1522 | 1521 | ||
1523 | FbTk::BiDiString label(std::string(buf, n)); | 1522 | FbTk::BiDiString label(std::string(buf, n)); |
1524 | m_geom_window->resizeForText(label); | 1523 | m_geom_window->resizeForText(label); |