Parcourir la source

changed -nk to -nkb

naelstrof il y a 10 ans
Parent
révision
db5a22ec55
1 fichiers modifiés avec 12 ajouts et 6 suppressions
  1. 12
    6
      options.cpp

+ 12
- 6
options.cpp Voir le fichier

@@ -20,9 +20,9 @@ void slop::Options::printHelp() {
20 20
     printf( "\n" );
21 21
     printf( "options\n" );
22 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 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 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 27
     printf( "    -x=STRING, --xdisplay=STRING   set x display (STRING must be hostname:number.screen_number format)\n" );
28 28
     printf( "    -c=COLOR, --color=COLOR        set selection rectangle color, COLOR is in format FLOAT,FLOAT,FLOAT\n" );
@@ -75,7 +75,7 @@ int slop::Options::parseOptions( int argc, char** argv ) {
75 75
             if ( err ) {
76 76
                 return 1;
77 77
             }
78
-        } else if ( matches( arg, "-nk", "--nokeyboard" ) ) {
78
+        } else if ( matches( arg, "-nkb", "--nokeyboard" ) ) {
79 79
             m_keyboard = false;
80 80
         } else if ( matches( arg, "-h", "--help" ) ) {
81 81
             printHelp();
@@ -135,9 +135,15 @@ int slop::Options::parseFloat( std::string arg, float* returnFloat ) {
135 135
 }
136 136
 
137 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 148
     return false;
143 149
 }