Add focus events checking

This commit is contained in:
Přemysl Eric Janouch 2020-09-14 01:51:02 +02:00
parent 632f88eeeb
commit 5331b49ed6
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 11 additions and 1 deletions

View File

@ -357,8 +357,18 @@ int main(int argc, char *argv[]) {
"Press a key once you've made it wide enough.\n", true)) "Press a key once you've made it wide enough.\n", true))
break; break;
} }
printf("Click the rightmost column, if it's possible.\n");
comm(CSI "?1000h" CSI "?1004h", false);
printf("Focus in and out of the window, press a key to abort.\n");
while (true) {
char *in = comm("", true);
if (*in != '\x1b') break;
else if (in[1] == '[' && in[2] == 'I') printf("Focused in.\n");
else if (in[1] == '[' && in[2] == 'O') printf("Focused out.\n");
}
comm(CSI "?1000l" CSI "?1004l", false);
printf("Click the rightmost column, if it's possible.\n");
int mouses[] = { 1005, 1006, 1015, 1016 }; int mouses[] = { 1005, 1006, 1015, 1016 };
for (size_t i = 0; i < sizeof mouses / sizeof *mouses; i++) { for (size_t i = 0; i < sizeof mouses / sizeof *mouses; i++) {
if (decrqm_supported) if (decrqm_supported)