diff --git a/src/cata_imgui.cpp b/src/cata_imgui.cpp index 40439cb2b087e..c5b43d88e4b5e 100644 --- a/src/cata_imgui.cpp +++ b/src/cata_imgui.cpp @@ -435,7 +435,7 @@ class cataimgui::window_impl ImVec2 imsize = ImGui::GetWindowSize(); imvec2_to_point( &impos, &catapos ); imvec2_to_point( &imsize, &catasize ); - window_adaptor->position( catapos, catasize ); + window_adaptor->position_absolute( catapos, catasize ); } ); window_adaptor->on_screen_resize( [this]( ui_adaptor & ) { is_resized = true; diff --git a/src/sdltiles.cpp b/src/sdltiles.cpp index d99ad5eb431fd..b773c3f97af7d 100644 --- a/src/sdltiles.cpp +++ b/src/sdltiles.cpp @@ -3788,11 +3788,6 @@ input_event input_manager::get_input_event( const keyboard_mode preferred_keyboa // we can skip screen update if `needupdate` is false to improve performance during mouse // move events. wnoutrefresh( catacurses::stdscr ); - // This statement is required when the screen is made very small - if( ui_adaptor::has_imgui() ) { - needupdate = true; - } - if( needupdate ) { refresh_display(); } diff --git a/src/ui_manager.cpp b/src/ui_manager.cpp index ec7cea68e0dab..d5b0ed7eea1e8 100644 --- a/src/ui_manager.cpp +++ b/src/ui_manager.cpp @@ -131,6 +131,15 @@ void ui_adaptor::position( const point &topleft, const point &size ) ui_manager::invalidate( old_dimensions, false ); } +void ui_adaptor::position_absolute( const point &topleft, const point &size ) +{ + const rectangle old_dimensions = dimensions; + // ensure position is updated before calling invalidate + dimensions = rectangle( topleft, topleft + size ); + invalidated = true; + ui_manager::invalidate( old_dimensions, false ); +} + void ui_adaptor::on_redraw( const redraw_callback_t &fun ) { redraw_cb = fun; diff --git a/src/ui_manager.h b/src/ui_manager.h index 48a1d2110c868..1c117fe937bca 100644 --- a/src/ui_manager.h +++ b/src/ui_manager.h @@ -127,6 +127,11 @@ class ui_adaptor * and curses builds. **/ void position( const point &topleft, const point &size ); + /** + * like 'position', except topleft and size are given as + * pixels in tiled builds and console cells on curses builds + **/ + void position_absolute( const point &topleft, const point &size ); /** * Set redraw and resize callbacks. The resize callback should * call `position` or `position_from_window` to set the size of the UI,