Skip to content

Commit

Permalink
Merge pull request #1 from selurvedu/master
Browse files Browse the repository at this point in the history
Support symbol strings with '_' in place of '+'
  • Loading branch information
nonpop committed Aug 2, 2015
2 parents 552ba98 + 2602e17 commit 3469f5c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
5 changes: 2 additions & 3 deletions X11Exception.h
Expand Up @@ -13,17 +13,16 @@ class X11Exception : public std::exception
{
public:
X11Exception() : _reason("unknown") {}
X11Exception(const std::string& what) : _reason(what) {}
explicit X11Exception(const std::string& what) : _reason(what) {}
virtual ~X11Exception() throw () {};
virtual const char* what() const throw () { return _reason.c_str(); }

private:
std::string _reason;
};

#endif // GAMEEXCEPTION_H_FE39A315_6827_447B_AE62_5FA2C3FD391F
#endif // X11EXCEPTION_H_FE39A315_6827_447B_AE62_5FA2C3FD391F

// Local Variables:
// mode: c++
// End:

4 changes: 2 additions & 2 deletions XKeyboard.cpp
Expand Up @@ -124,7 +124,7 @@ Bool XKeyboard::initializeXkb()
groupName = groupNameC;
std::string::size_type pos = groupName.find('(', 0);
if (pos != std::string::npos) {
groupName = groupName.substr(0, pos + 1);
groupName = groupName.substr(0, pos - 1);
}
_groupNames.push_back(groupName);
}
Expand Down Expand Up @@ -327,7 +327,7 @@ void XkbSymbolParser::parse(const std::string& symbols, StringVector& symbolList

for (size_t i = 0; i < symbols.size(); i++) {
char ch = symbols[i];
if (ch == '+') {
if (ch == '+' || ch == '_') {
if (inSymbol) {
if (isXkbLayoutSymbol(curSymbol)) {
symbolList.push_back(curSymbol);
Expand Down
6 changes: 3 additions & 3 deletions wrapper.cpp
Expand Up @@ -59,7 +59,7 @@ bool print_status(XKeyboard& xkb, string format) {
stringstream r; // resulting string

for (size_t i = 0; i < format.length(); ++i) {
if (format[i] == '%' && i < format.length()-1) {
if (i < format.length()-2 && format[i] == '%') {
switch (format[i+1]) {
case 'c':
r << xkb.currentGroupNum();
Expand Down Expand Up @@ -180,8 +180,8 @@ int main(int argc, char* argv[])
}
}
}
catch (exception e) {
cerr << e.what() << endl;
catch (const exception *e) {
cerr << e->what() << endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
Expand Down

0 comments on commit 3469f5c

Please sign in to comment.