Skip to content

Commit

Permalink
Fix inventory UI highlight not displayed when opening the UI or resiz…
Browse files Browse the repository at this point in the history
…ing the window
  • Loading branch information
Qrox committed Oct 5, 2020
1 parent 8e6077e commit c63eb25
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 4 additions & 6 deletions src/inventory_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1703,6 +1703,10 @@ void inventory_selector::refresh_window()
{
cata_assert( w_inv );

if( get_option<std::string>( "INVENTORY_HIGHLIGHT" ) != "disable" ) {
highlight();
}

werase( w_inv );

draw_frame( w_inv );
Expand Down Expand Up @@ -2120,9 +2124,6 @@ item_location inventory_pick_selector::execute()
{
shared_ptr_fast<ui_adaptor> ui = create_or_get_ui_adaptor();
while( true ) {
if( get_option<std::string>( "INVENTORY_HIGHLIGHT" ) != "disable" ) {
highlight();
}
ui_manager::redraw();
const inventory_input input = get_input();

Expand Down Expand Up @@ -2466,9 +2467,6 @@ drop_locations inventory_drop_selector::execute()

int count = 0;
while( true ) {
if( get_option<std::string>( "INVENTORY_HIGHLIGHT" ) != "disable" ) {
highlight();
}
ui_manager::redraw();

const inventory_input input = get_input();
Expand Down
8 changes: 7 additions & 1 deletion src/ui_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,13 @@ namespace ui_manager
{
// rect is the pixel dimensions in tiles or console cell dimensions in curses
void invalidate( const rectangle<point> &rect, bool reenable_uis_below );
// invalidate the top window and redraw all invalidated windows
/*
* Invalidate the top window and redraw all invalidated windows.
* Note that `ui_manager` may redraw multiple times when the game window is
* resized or the system requests a redraw during input calls, so any drawing
* code and other code that generates non-persistent UI info should be called
* inside the redraw callbacks of `ui_adaptor`, instead of being called directly.
*/
void redraw();
// redraw all invalidated windows without invalidating the top window
void redraw_invalidated();
Expand Down

0 comments on commit c63eb25

Please sign in to comment.