Browse Source

changed -nk to -nkb

naelstrof 11 years ago
parent
commit
db5a22ec55
1 changed files with 12 additions and 6 deletions
  1. 12
    6
      options.cpp

+ 12
- 6
options.cpp View File

20
     printf( "\n" );
20
     printf( "\n" );
21
     printf( "options\n" );
21
     printf( "options\n" );
22
     printf( "    -h, --help                     show this message.\n" );
22
     printf( "    -h, --help                     show this message.\n" );
23
-    printf( "    -nk, --nokeyboard              don't try to grab the keyboard. This may fix problems with certain window managers.\n" );
23
+    printf( "    -nkb, --nokeyboard             don't try to grab the keyboard. This may fix problems with certain window managers.\n" );
24
     printf( "    -b=INT, --bordersize=INT       set selection rectangle border size.\n" );
24
     printf( "    -b=INT, --bordersize=INT       set selection rectangle border size.\n" );
25
-    printf( "    -p=INT, --m_padding=INT        set m_padding size for selection.\n" );
25
+    printf( "    -p=INT, --padding=INT          set padding size for selection.\n" );
26
     printf( "    -t=INT, --tolerance=INT        if you have a shaky mouse, increasing this value will make slop detect single clicks better. Rather than interpreting your shaky clicks as region selections.\n" );
26
     printf( "    -t=INT, --tolerance=INT        if you have a shaky mouse, increasing this value will make slop detect single clicks better. Rather than interpreting your shaky clicks as region selections.\n" );
27
     printf( "    -x=STRING, --xdisplay=STRING   set x display (STRING must be hostname:number.screen_number format)\n" );
27
     printf( "    -x=STRING, --xdisplay=STRING   set x display (STRING must be hostname:number.screen_number format)\n" );
28
     printf( "    -c=COLOR, --color=COLOR        set selection rectangle color, COLOR is in format FLOAT,FLOAT,FLOAT\n" );
28
     printf( "    -c=COLOR, --color=COLOR        set selection rectangle color, COLOR is in format FLOAT,FLOAT,FLOAT\n" );
75
             if ( err ) {
75
             if ( err ) {
76
                 return 1;
76
                 return 1;
77
             }
77
             }
78
-        } else if ( matches( arg, "-nk", "--nokeyboard" ) ) {
78
+        } else if ( matches( arg, "-nkb", "--nokeyboard" ) ) {
79
             m_keyboard = false;
79
             m_keyboard = false;
80
         } else if ( matches( arg, "-h", "--help" ) ) {
80
         } else if ( matches( arg, "-h", "--help" ) ) {
81
             printHelp();
81
             printHelp();
135
 }
135
 }
136
 
136
 
137
 bool slop::Options::matches( std::string arg, std::string shorthand, std::string longhand ) {
137
 bool slop::Options::matches( std::string arg, std::string shorthand, std::string longhand ) {
138
-    if ( arg.substr( 0, shorthand.size() ) == shorthand ||
139
-         arg.substr( 0, longhand.size() ) == longhand ) {
140
-        return true;
138
+    if ( arg.substr( 0, shorthand.size() ) == shorthand ) {
139
+        if ( arg == shorthand || shorthand[shorthand.length()-1] == '=' ) {
140
+            return true;
141
+        }
142
+    }
143
+    if ( longhand.size() && arg.substr( 0, longhand.size() ) == longhand ) {
144
+        if ( arg == longhand || longhand[longhand.length()-1] == '=' ) {
145
+            return true;
146
+        }
141
     }
147
     }
142
     return false;
148
     return false;
143
 }
149
 }