-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 when trying to wipe through my windows via cmdline (because some stupid game stole my mouse or whatever) i get annoyed when trying to type out window ids ... sometimes i incorrectly count the # of 0's or the simple factor of trying to type a hex number at lightning speed gets the better of me ...
either way, when i screw up, it makes me angry because i have to retype the damned thing ;) so i made a patch to enable a cheap search/match ... just type 'p' and then the first few bits of the window id ... p stands for partial ... for example: <eesh example> [EMAIL PROTECTED] 0 root # eesh wl 1800045 : [EMAIL PROTECTED]:~ 120153c : patch to make eesh even more obscure - KMail 40027e : 0 1600002 : X-Chat [2.0.6]: SpanKY @ lepton.oftc.net / #gentoo (+stncl 69) wop p16 move 0 0 </eesh example> here we did a partial match against the window id 1600002. the matching does a string comparison starting with the first few characters ... why you ask ? because we english speakers read right to left and the first few chars are usually pretty nicely distributed ... at any rate, the algorithm just looks until it gets a match ... so if in the previous case i typed 'p1' it would have matched '1800045' instead of something else ... yes i know the order changes as you focus other windows or do whatever, but in the space of typing 'eesh' and then 'wop p###' i doubt the order will change ... and if it does, well you should have typed out the window id :P i also added a few shortcuts for the move, raise, and lower window operations (m, r, and l respectively of course) - -mike -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iQIVAwUBP8+/b0FjO5/oN/WBAQIGqg//XK5EHHUoo3CElSMsyp+Sd9HLEghYsH9b KgfoAn7a/Jnyni68OgRduC2MhjmXK6H+UeIe0+3P9sIX46TIUI+Lr3mRRHp3KxGw gnWp6uWsPlt2SrZAtG29Tv9q+DNFC3hWoi5y3vaqiCfwAbQO2Ca/D9vhz5ExhjoW cibzfuJlUYKU5GcNS8VAHXnL0R6LRxgkGMpp54dRtgxxqIuojvB1KN0SFaaAKq7E 3XtuGHPrbTG6xg3rrqJFYwGAh2Zkl6p2ApgzBXPW6sCGZ6QO87kcuqJTaJ0cVQyc fguXSFUS4CIyJxfeWyESD7ENtRjqrHVUej00C1RIYPYLpnb9DOPaY67Ij57IlzXD q2sR9iPUP/FJnRnTE/rqzMYqyVOdwT9k2CA7XiLmMk1fqNB3lnX6VRH7i+UOkr/V VzvXxtmkG4SwwNFYIBYEpyTiawjndsGJODaV/BsUEhvoZk8fB/MhMUToyCs4iCdb 3yXZO9QJNcbukbFO0ziOTbYI/n9IH50fjW5efwLSHFu1MGI4w5ED8Q4Wlp3QVAcD UKIYiyTFvQcT4UtQT3QjbG0IajK1Jlqmn6V0BEuoX4hcEiUutKSPi0XjLvwOy44K iap7yLTB51Er+immRxkvCUBTEB54zMF2Q2AUWu2O2F9iMverCZZChxAvFOzHUM8Y vq2IDFaFBjE= =eQx4 -----END PGP SIGNATURE-----
diff -ur /usr/local/src/e17/e16/e/src/E.h src/E.h --- /usr/local/src/e17/e16/e/src/E.h 2003-11-30 10:35:43.000000000 -0500 +++ src/E.h 2003-12-04 17:52:05.728326944 -0500 @@ -2150,6 +2150,7 @@ EWin *FindEwinByBase(Window win); EWin *FindEwinByChildren(Window win); +EWin *FindEwinByPartial(char *win); EWin *FindEwinByDecoration(Window win); Button *FindButton(Window win); ActionClass *FindActionClass(Window win); diff -ur /usr/local/src/e17/e16/e/src/finders.c src/finders.c --- /usr/local/src/e17/e16/e/src/finders.c 2003-11-09 15:28:24.000000000 -0500 +++ src/finders.c 2003-12-04 17:56:23.968068536 -0500 @@ -80,6 +80,33 @@ } EWin * +FindEwinByPartial(char *win) +{ + EWin *ewin; + EWin **ewins; + int i, j, num, inlen; + char ewinid[FILEPATH_LEN_MAX]; + + EDBUG(6, "FindEwinByPartial"); + + inlen = strlen(win); + ewins = (EWin **) ListItemType(&num, LIST_TYPE_EWIN); + for (i = 0; i < num; i++) + { + sprintf(ewinid, "%x", ewins[i]->client.win); + if (!strncmp(win, ewinid, inlen)) + { + ewin = ewins[i]; + Efree(ewins); + EDBUG_RETURN(ewin); + } + } + if (ewins) + Efree(ewins); + EDBUG_RETURN(NULL); +} + +EWin * FindEwinByDecoration(Window win) { EWin *ewin; diff -ur /usr/local/src/e17/e16/e/src/ipc.c src/ipc.c --- /usr/local/src/e17/e16/e/src/ipc.c 2003-11-21 19:15:40.000000000 -0500 +++ src/ipc.c 2003-12-04 17:58:47.269283440 -0500 @@ -3744,10 +3744,12 @@ char operation[FILEPATH_LEN_MAX]; char param1[FILEPATH_LEN_MAX]; unsigned int win; + unsigned int findwindow; windowid[0] = 0; operation[0] = 0; param1[0] = 0; + findwindow = 0; word(params, 1, windowid); if (!strcmp(windowid, "current")) { @@ -3763,6 +3765,11 @@ return; } } + else if (!strncmp(windowid, "p", 1)) + { + findwindow = 1; + sscanf(windowid+1, "%x", &win); + } else { sscanf(windowid, "%x", &win); @@ -3776,7 +3783,10 @@ { EWin *ewin; - ewin = FindEwinByChildren(win); + if (!findwindow) + ewin = FindEwinByChildren(win); + else + ewin = FindEwinByPartial(windowid+1); if (!ewin) { Esnprintf(buf, sizeof(buf), "Error: no such window: %8x", @@ -4096,15 +4106,15 @@ "Error: no area supplied"); } } - else if (!strcmp(operation, "raise")) + else if (!strcmp(operation, "raise") || !strcmp(operation, "r")) { RaiseEwin(ewin); } - else if (!strcmp(operation, "lower")) + else if (!strcmp(operation, "lower") || !strcmp(operation, "l")) { LowerEwin(ewin); } - else if (!strcmp(operation, "move")) + else if (!strcmp(operation, "move") || !strcmp(operation, "m")) { int a, b;