Formspecs: Fix invalid background warning
authorrubenwardy <rw@rubenwardy.com>
Mon, 20 Aug 2018 12:56:16 +0000 (13:56 +0100)
committerGitHub <noreply@github.com>
Mon, 20 Aug 2018 12:56:16 +0000 (13:56 +0100)
Clipped backgrounds are still valid with no size[] tag, as they will apply themselves correctly to any size

Fixes #7197

src/gui/guiFormSpecMenu.cpp

index 948ee40305aeb0f3a9a1ac05352b9aac1f074093..ed94b82defe36de04c8854402c0d96bcc11e753b 100644 (file)
@@ -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;