diff --git a/src/theme.cpp b/src/theme.cpp index a888775ec61..88c67e0454c 100644 --- a/src/theme.cpp +++ b/src/theme.cpp @@ -583,6 +583,7 @@ theme::theme(const config& cfg, const SDL_Rect& screen) , unit_image_() , palette_() , border_() + , screen_dimensions_(screen) { do_resolve_rects(expand_partialresolution(cfg), cfg_); set_resolution(screen); @@ -613,6 +614,8 @@ theme& theme::operator=(theme&& other) bool theme::set_resolution(const SDL_Rect& screen) { + screen_dimensions_ = screen; + bool result = false; int current_rating = 1000000; @@ -756,7 +759,10 @@ void theme::add_object(const config& cfg) border_ = border_t(c); } - if(!desktop::battery_info::does_device_have_battery()) { + // Battery charge indicator is always hidden if there isn't enough horizontal space + // (GitHub issue #3714) + static const int BATTERY_ICON_MIN_WIDTH = 1152; + if(!desktop::battery_info::does_device_have_battery() || screen_dimensions_.w < BATTERY_ICON_MIN_WIDTH) { if(const config& c = cfg.child("no_battery")) { modify(c); } diff --git a/src/theme.hpp b/src/theme.hpp index 9c05339ecbc..cb60dfd9fea 100644 --- a/src/theme.hpp +++ b/src/theme.hpp @@ -308,4 +308,6 @@ private: object main_map_, mini_map_, unit_image_, palette_; border_t border_; + + SDL_Rect screen_dimensions_; };