|
@@ -3,7 +3,7 @@
|
3
|
3
|
slop::Options* options = new slop::Options();
|
4
|
4
|
|
5
|
5
|
slop::Options::Options() {
|
6
|
|
- m_version = "v2.0.7";
|
|
6
|
+ m_version = "v2.0.8";
|
7
|
7
|
m_borderSize = 10;
|
8
|
8
|
m_padding = 0;
|
9
|
9
|
m_xdisplay = ":0";
|
|
@@ -11,6 +11,7 @@ slop::Options::Options() {
|
11
|
11
|
m_red = 0;
|
12
|
12
|
m_green = 0;
|
13
|
13
|
m_blue = 0;
|
|
14
|
+ m_alpha = 1;
|
14
|
15
|
m_gracetime = 0.4;
|
15
|
16
|
m_keyboard = true;
|
16
|
17
|
m_decorations = true;
|
|
@@ -30,7 +31,7 @@ void slop::Options::printHelp() {
|
30
|
31
|
printf( " -t=INT, --tolerance=INT How far in pixels the mouse can move after clicking and still be detected\n" );
|
31
|
32
|
printf( " as a normal click. Setting to zero will disable window selections.\n" );
|
32
|
33
|
printf( " -x=STRING, --xdisplay=STRING Set x display (STRING must be hostname:number.screen_number format)\n" );
|
33
|
|
- printf( " -c=COLOR, --color=COLOR Set selection rectangle color, COLOR is in format FLOAT,FLOAT,FLOAT\n" );
|
|
34
|
+ printf( " -c=COLOR, --color=COLOR Set selection rectangle color, COLOR is in format FLOAT,FLOAT,FLOAT,FLOAT\n" );
|
34
|
35
|
printf( " -g=FLOAT, --gracetime=FLOAT Set the amount of time before slop will check for keyboard cancellations\n" );
|
35
|
36
|
printf( " in seconds.\n" );
|
36
|
37
|
printf( " -nd, --nodecorations attempts to remove decorations from window selections.\n" );
|
|
@@ -40,8 +41,8 @@ void slop::Options::printHelp() {
|
40
|
41
|
printf( " -v, --version prints version.\n" );
|
41
|
42
|
printf( "\n" );
|
42
|
43
|
printf( "Examples\n" );
|
43
|
|
- printf( " $ # Gray, thick border for maximum visiblity.\n" );
|
44
|
|
- printf( " $ slop -b=20 -c=0.5,0.5,0.5\n" );
|
|
44
|
+ printf( " $ # Gray, thick, transparent border for maximum visiblity.\n" );
|
|
45
|
+ printf( " $ slop -b=20 -c=0.5,0.5,0.5,0.8\n" );
|
45
|
46
|
printf( "\n" );
|
46
|
47
|
printf( " $ # Remove window decorations.\n" );
|
47
|
48
|
printf( " $ slop -nd\n" );
|
|
@@ -79,7 +80,7 @@ int slop::Options::parseOptions( int argc, char** argv ) {
|
79
|
80
|
return 1;
|
80
|
81
|
}
|
81
|
82
|
} else if ( matches( arg, "-c=", "--color=" ) ) {
|
82
|
|
- int err = parseColor( arg, &m_red, &m_green, &m_blue );
|
|
83
|
+ int err = parseColor( arg, &m_red, &m_green, &m_blue, &m_alpha );
|
83
|
84
|
if ( err ) {
|
84
|
85
|
return 1;
|
85
|
86
|
}
|
|
@@ -211,7 +212,7 @@ int slop::Options::parseString( std::string arg, std::string* returnString ) {
|
211
|
212
|
return 0;
|
212
|
213
|
}
|
213
|
214
|
|
214
|
|
-int slop::Options::parseColor( std::string arg, float* r, float* g, float* b ) {
|
|
215
|
+int slop::Options::parseColor( std::string arg, float* r, float* g, float* b, float* a ) {
|
215
|
216
|
std::string copy = arg;
|
216
|
217
|
int find = copy.find( "=" );
|
217
|
218
|
while( find != copy.npos ) {
|
|
@@ -221,11 +222,13 @@ int slop::Options::parseColor( std::string arg, float* r, float* g, float* b ) {
|
221
|
222
|
|
222
|
223
|
// Just in case we error out, grab the actual argument name into x.
|
223
|
224
|
char* x = new char[ arg.size() ];
|
224
|
|
- int num = sscanf( copy.c_str(), "%s %f %f %f", x, r, g, b );
|
225
|
|
- if ( num != 4 ) {
|
|
225
|
+ // Just in case we didn't include an alpha value
|
|
226
|
+ *a = 1;
|
|
227
|
+ int num = sscanf( copy.c_str(), "%s %f %f %f %f", x, r, g, b, a );
|
|
228
|
+ if ( num != 4 && num != 5 ) {
|
226
|
229
|
fprintf( stderr, "Error parsing command arguments near %s\n", arg.c_str() );
|
227
|
230
|
fprintf( stderr, "Usage: %s=COLOR\n", x );
|
228
|
|
- fprintf( stderr, "Example: %s=0,0,0 or %s=0.7,0.2,1\n", x, x );
|
|
231
|
+ fprintf( stderr, "Example: %s=0,0,0 or %s=0.7,0.2,1,0.5 or %s=1,1,1,0.8\n", x, x, x );
|
229
|
232
|
fprintf( stderr, "Try -h or --help for help.\n" );
|
230
|
233
|
delete[] x;
|
231
|
234
|
return 1;
|