diff --git a/src/gui/screensaver.cpp b/src/gui/screensaver.cpp index 5082fec27..1ded487eb 100644 --- a/src/gui/screensaver.cpp +++ b/src/gui/screensaver.cpp @@ -283,14 +283,10 @@ void CScreenSaver::paint() //check position and size use only possible available screen size int x_cl, y_cl, w_cl, h_cl; - scr_clock->getDimensions( &x_cl, &y_cl, &w_cl, &h_cl); - bool unchecked = true; - while(unchecked){ - scr_clock->setPosP(uint8_t(rand() % 100),uint8_t(rand() % 100)); - scr_clock->getDimensions( &x_cl, &y_cl, &w_cl, &h_cl); - if (x_cl+w_cl < g_settings.screen_EndX && y_cl+h_cl < g_settings.screen_EndY) - unchecked = false; - } + scr_clock->getDimensions(&x_cl, &y_cl, &w_cl, &h_cl); + int x_random = rand() % ((g_settings.screen_EndX - w_cl - g_settings.screen_StartX) + 1) + g_settings.screen_StartX; + int y_random = rand() % ((g_settings.screen_EndY - h_cl - g_settings.screen_StartY) + 1) + g_settings.screen_StartY; + scr_clock->setPos(x_random, y_random); scr_clock->Start(); if (g_settings.screensaver_mode == SCR_MODE_CLOCK_COLOR) {