Adding xgeometry standard parsing to svkbd.
This commit is contained in:
parent
cc4f2c36ba
commit
08b907930c
45
svkbd.c
45
svkbd.c
@ -556,44 +556,39 @@ updatekeys() {
|
|||||||
|
|
||||||
void
|
void
|
||||||
usage(char *argv0) {
|
usage(char *argv0) {
|
||||||
fprintf(stderr, "usage: %s [-htv] [-wh height] [-ww width] "
|
fprintf(stderr, "usage: %s [-htv] [-g geometry]\n", argv0);
|
||||||
"[-wx x position] [-wy y position]\n", argv0);
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[]) {
|
main(int argc, char *argv[]) {
|
||||||
int i;
|
int i, xr, yr, bitm;
|
||||||
|
unsigned int wr, hr;
|
||||||
|
|
||||||
for (i = 1; argv[i]; i++) {
|
for (i = 1; argv[i]; i++) {
|
||||||
if(!strcmp(argv[i], "-v")) {
|
if(!strcmp(argv[i], "-v")) {
|
||||||
die("svkbd-"VERSION", © 2006-2010 svkbd engineers,"
|
die("svkbd-"VERSION", © 2006-2010 svkbd engineers,"
|
||||||
" see LICENSE for details\n");
|
" see LICENSE for details\n");
|
||||||
}
|
} else if(!strcmp(argv[i], "-t")) {
|
||||||
if(!strcmp(argv[i], "-t")) {
|
|
||||||
istoolbar = True;
|
istoolbar = True;
|
||||||
continue;
|
continue;
|
||||||
}
|
} else if(!strcmp(argv[i], "-g")) {
|
||||||
else if(argv[i][0] == '-' && argv[i][1] == 'w') {
|
bitm = XParseGeometry(argv[i+1], &xr, &yr, &wr, &hr);
|
||||||
switch(i >= argc - 1 ? 0 : argv[i][2]) {
|
if(bitm & XValue)
|
||||||
case 'h':
|
wx = xr;
|
||||||
wh = atoi(argv[i+1]);
|
if(bitm & YValue)
|
||||||
break;
|
wy = yr;
|
||||||
case 'w':
|
if(bitm & WidthValue)
|
||||||
ww = atoi(argv[i+1]);
|
ww = (int)wr;
|
||||||
break;
|
if(bitm & HeightValue)
|
||||||
case 'x':
|
wh = (int)hr;
|
||||||
wx = atoi(argv[i+1]);
|
if(bitm & XNegative)
|
||||||
break;
|
wx *= -1;
|
||||||
case 'y':
|
if(bitm & YNegative)
|
||||||
wy = atoi(argv[i+1]);
|
wy *= -1;
|
||||||
break;
|
} else if(!strcmp(argv[i], "-h")) {
|
||||||
default:
|
|
||||||
usage(argv[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(!strcmp(argv[i], "-h"))
|
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!setlocale(LC_CTYPE, "") || !XSupportsLocale())
|
if(!setlocale(LC_CTYPE, "") || !XSupportsLocale())
|
||||||
|
Loading…
Reference in New Issue
Block a user