Ticket #4609: gui_width_height_check.patch

File gui_width_height_check.patch, 2.9 KB (added by lordhoto, 14 years ago)
  • gui/GuiManager.cpp

    diff --git a/gui/GuiManager.cpp b/gui/GuiManager.cpp
    index 931c307..3d02816 100644
    a b GuiManager::GuiManager() : _redrawStatus(kRedrawDisabled),  
    5454
    5555        _system = g_system;
    5656        _lastScreenChangeID = _system->getScreenChangeID();
     57        _width = _system->getOverlayWidth();
     58        _height = _system->getOverlayHeight();
    5759
    5860        // Clear the cursor
    5961        memset(_cursor, 0xFF, sizeof(_cursor));
    bool GuiManager::checkScreenChange() {  
    448450
    449451void GuiManager::screenChange() {
    450452        _lastScreenChangeID = _system->getScreenChangeID();
     453        _width = _system->getOverlayWidth();
     454        _height = _system->getOverlayHeight();
    451455
    452456        // reinit the whole theme
    453457        _theme->refresh();
  • gui/GuiManager.h

    diff --git a/gui/GuiManager.h b/gui/GuiManager.h
    index a5e7548..892d1aa 100644
    a b public:  
    7676
    7777        ThemeEval *xmlEval() { return _theme->getEvaluator(); }
    7878
     79        int getWidth() const { return _width; }
     80        int getHeight() const { return _height; }
     81
    7982        const Graphics::Font &getFont(ThemeEngine::FontStyle style = ThemeEngine::kFontStyleBold) const { return *(_theme->getFont(style)); }
    8083        int getFontHeight(ThemeEngine::FontStyle style = ThemeEngine::kFontStyleBold) const { return _theme->getFontHeight(style); }
    8184        int getStringWidth(const Common::String &str, ThemeEngine::FontStyle style = ThemeEngine::kFontStyleBold) const { return _theme->getStringWidth(str, style); }
    protected:  
    104107//      bool            _needRedraw;
    105108        RedrawStatus _redrawStatus;
    106109        int                     _lastScreenChangeID;
     110        int                     _width, _height;
    107111        DialogStack     _dialogStack;
    108112
    109113        bool            _stateIsSaved;
  • gui/object.cpp

    diff --git a/gui/object.cpp b/gui/object.cpp
    index f24ce09..aaa5a1a 100644
    a b void GuiObject::reflowLayout() {  
    4848
    4949                if (_x < 0)
    5050                        error("Widget <%s> has x < 0 (%d)", _name.c_str(), _x);
    51                 if (_x >= g_system->getOverlayWidth())
    52                         error("Widget <%s> has x > %d (%d)", _name.c_str(), g_system->getOverlayWidth(), _x);
    53                 if (_x + _w > g_system->getOverlayWidth())
    54                         error("Widget <%s> has x + w > %d (%d)", _name.c_str(), g_system->getOverlayWidth(), _x + _w);
     51                if (_x >= g_gui.getWidth())
     52                        error("Widget <%s> has x > %d (%d)", _name.c_str(), g_gui.getWidth(), _x);
     53                if (_x + _w > g_gui.getWidth())
     54                        error("Widget <%s> has x + w > %d (%d)", _name.c_str(), g_gui.getWidth(), _x + _w);
    5555                if (_y < 0)
    5656                        error("Widget <%s> has y < 0 (%d)", _name.c_str(), _y);
    57                 if (_y >= g_system->getOverlayHeight())
    58                         error("Widget <%s> has y > %d (%d)", _name.c_str(), g_system->getOverlayHeight(), _y);
    59                 if (_y + _h > g_system->getOverlayHeight())
    60                         error("Widget <%s> has y + h > %d (%d)", _name.c_str(), g_system->getOverlayHeight(), _y + _h);
     57                if (_y >= g_gui.getHeight())
     58                        error("Widget <%s> has y > %d (%d)", _name.c_str(), g_gui.getHeight(), _y);
     59                if (_y + _h > g_gui.getHeight())
     60                        error("Widget <%s> has y + h > %d (%d)", _name.c_str(), g_gui.getHeight(), _y + _h);
    6161        }
    6262}
    6363