+ // this code ensures that the string only has one of each possible
+ // letter, all of the letters are valid, and L exists somewhere in the
+ // string!
+ bool tit_l = false;
+
+ for (std::string::size_type i = 0; i < layout.size(); ++i) {
+ switch (layout[i]) {
+ case 'i':
+ case 'I':
+ if (!tit_i && (_decorations & OBClient::Decor_Iconify)) {
+ tit_i = true;
+ continue;
+ }
+ break;
+ case 'l':
+ case 'L':
+ if (!tit_l) {
+ tit_l = true;
+ continue;
+ }
+ break;
+ case 'm':
+ case 'M':
+ if (!tit_m && (_decorations & OBClient::Decor_Maximize)) {
+ tit_m = true;
+ continue;
+ }
+ break;
+ case 's':
+ case 'S':
+ if (!tit_s && (_decorations & OBClient::Decor_Sticky)) {
+ tit_s = true;
+ continue;
+ }
+ break;
+ case 'c':
+ case 'C':
+ if (!tit_c && (_decorations & OBClient::Decor_Close)) {
+ tit_c = true;
+ continue;
+ }
+ break;
+ }
+ // if we get here then we don't want the letter, kill it
+ layout.erase(i--, 1);
+ }
+ if (!tit_l)
+ layout.append(1, 'L');
+