@@ -51,10 +51,10 @@ MainWindow::MainWindow(QWidget* parent)
5151 auto const screen_geometry = QGuiApplication::primaryScreen ()->availableGeometry ();
5252 uint32_t const screen_width = (uint32_t )screen_geometry.width ();
5353 uint32_t const screen_height = (uint32_t )screen_geometry.height ();
54- uint32_t initial_x_pos_main = GlobalSettings::instance ().WINDOW_SIZE ->INITIAL_X_POS ;
55- uint32_t initial_y_pos_main = GlobalSettings::instance ().WINDOW_SIZE ->INITIAL_Y_POS ;
56- uint32_t move_x_main = std::min (initial_x_pos_main, screen_width- 100 );
57- uint32_t move_y_main = std::min (initial_y_pos_main, screen_height- 100 );
54+ int32_t initial_x_pos_main = GlobalSettings::instance ().WINDOW_SIZE ->INITIAL_X_POS ;
55+ int32_t initial_y_pos_main = GlobalSettings::instance ().WINDOW_SIZE ->INITIAL_Y_POS ;
56+ int32_t move_x_main = std::max ( 0 , std:: min (initial_x_pos_main, ( int32_t )( screen_width* 0.97 )) );
57+ int32_t move_y_main = std::max ( 0 , std:: min (initial_y_pos_main, ( int32_t )( screen_height* 0.97 )) );
5858 move (scale_dpi_width (move_x_main), scale_dpi_height (move_y_main));
5959
6060 centralwidget = new QWidget (this );
@@ -222,8 +222,8 @@ MainWindow::MainWindow(QWidget* parent)
222222 );
223223 // get snapshot of the saved initial x/y position, since activating the window seems to change the window coordinates,
224224 // which then causes initial x/y position to change, due to triggering moveEvent().
225- uint32_t initial_x_pos_log = GlobalSettings::instance ().LOG_WINDOW_SIZE ->INITIAL_X_POS ;
226- uint32_t initial_y_pos_log = GlobalSettings::instance ().LOG_WINDOW_SIZE ->INITIAL_Y_POS ;
225+ int32_t initial_x_pos_log = GlobalSettings::instance ().LOG_WINDOW_SIZE ->INITIAL_X_POS ;
226+ int32_t initial_y_pos_log = GlobalSettings::instance ().LOG_WINDOW_SIZE ->INITIAL_Y_POS ;
227227
228228 if (GlobalSettings::instance ().LOG_WINDOW_STARTUP ){ // show the Output Window on startup
229229 m_output_window->show ();
@@ -232,8 +232,8 @@ MainWindow::MainWindow(QWidget* parent)
232232 }
233233
234234 // move the output window to desired position on startup
235- uint32_t move_x_log = std::min (initial_x_pos_log, screen_width- 100 );
236- uint32_t move_y_log = std::min (initial_y_pos_log, screen_height- 100 );
235+ int32_t move_x_log = std::max ( 0 , std:: min (initial_x_pos_log, ( int32_t )( screen_width* 0.97 ))); // ensure move_x is greater than 0, but less than screen_width
236+ int32_t move_y_log = std::max ( 0 , std:: min (initial_y_pos_log, ( int32_t )( screen_height* 0.97 )) );
237237 m_output_window->move (scale_dpi_width (move_x_log), scale_dpi_height (move_y_log));
238238 }
239239 {
0 commit comments