Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inventory UI highlight not displayed when opening the UI or resizing the window #44633

Merged
merged 1 commit into from
Oct 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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