Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Formspecs: Fix invalid background warning
Clipped backgrounds are still valid with no size[] tag, as they will apply themselves correctly to any size

Fixes #7197
  • Loading branch information
rubenwardy committed Aug 20, 2018
1 parent 3cc25b7 commit 5a26e46
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/gui/guiFormSpecMenu.cpp
Expand Up @@ -668,15 +668,16 @@ void GUIFormSpecMenu::parseBackground(parserData* data, const std::string &eleme
geom.X = stof(v_geom[0]) * spacing.X;
geom.Y = stof(v_geom[1]) * spacing.Y;

if (!data->explicit_size)
warningstream<<"invalid use of background without a size[] element"<<std::endl;

bool clip = false;
if (parts.size() == 4 && is_yes(parts[3])) {
pos.X = stoi(v_pos[0]); //acts as offset
pos.Y = stoi(v_pos[1]); //acts as offset
clip = true;
}

if (!data->explicit_size && !clip)
warningstream << "invalid use of unclipped background without a size[] element" << std::endl;

m_backgrounds.emplace_back(name, pos, geom, clip);

return;
Expand Down

0 comments on commit 5a26e46

Please sign in to comment.