diff options
author | Mattias Andrée <maandree@kth.se> | 2021-04-10 19:20:30 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2021-04-10 19:20:30 +0200 |
commit | 0edd4e9312117009756ca6185c845a71bdd58fb9 (patch) | |
tree | 7746717657b05109cc7e1fa1b328903ee64ed6c2 /test.c | |
parent | Add tests for mouse events (diff) | |
download | libterminput-0edd4e9312117009756ca6185c845a71bdd58fb9.tar.gz libterminput-0edd4e9312117009756ca6185c845a71bdd58fb9.tar.bz2 libterminput-0edd4e9312117009756ca6185c845a71bdd58fb9.tar.xz |
Fix mouse tracking support and add more tests for it
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | test.c | 344 |
1 files changed, 221 insertions, 123 deletions
@@ -114,6 +114,128 @@ static const struct keynum { {0, 0, 0, 0} }; +static const struct mouse { + const char *str; + enum libterminput_event event; + enum libterminput_button button; + enum libterminput_mod mods; + int x; + int y; +} mice[] = { + {"\033[32;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, 0, 1, 2}, + {"\033[33;61;19M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, 0, 61, 19}, + {"\033[34;6115;1559M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, 0, 6115, 1559}, + {"\033[35;0;0M", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, 0, 1, 1}, + {"\033[36;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[37;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[38;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[39;5;6M", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[40;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_META, 5, 6}, + {"\033[41;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_META, 5, 6}, + {"\033[42;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_META, 5, 6}, + {"\033[43;5;6M", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_META, 5, 6}, + {"\033[44;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_META | LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[45;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_META | LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[46;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_META | LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[47;5;6M", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_META | LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[48;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_CTRL, 5, 6}, + {"\033[49;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_CTRL, 5, 6}, + {"\033[50;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_CTRL, 5, 6}, + {"\033[51;5;6M", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_CTRL, 5, 6}, + {"\033[52;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_CTRL | LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[53;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_CTRL | LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[54;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_CTRL | LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[55;5;6M", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_CTRL | LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[56;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_CTRL | LIBTERMINPUT_META, 5, 6}, + {"\033[57;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_CTRL | LIBTERMINPUT_META, 5, 6}, + {"\033[58;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_CTRL | LIBTERMINPUT_META, 5, 6}, + {"\033[59;5;6M", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_CTRL | LIBTERMINPUT_META, 5, 6}, + {"\033[64;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_BUTTON1, 0, 5, 6}, + {"\033[65;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_BUTTON2, 0, 5, 6}, + {"\033[66;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_BUTTON3, 0, 5, 6}, + {"\033[67;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_NO_BUTTON, 0, 5, 6}, + {"\033[68;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[69;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[70;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[71;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_NO_BUTTON, LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[96;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_SCROLL_UP, 0, 1, 2}, + {"\033[97;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_SCROLL_DOWN, 0, 1, 2}, + {"\033[98;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_SCROLL_LEFT, 0, 1, 2}, + {"\033[99;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_SCROLL_RIGHT, 0, 1, 2}, + {"\033[160;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON1, 0, 1, 2}, + {"\033[161;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON2, 0, 1, 2}, + {"\033[162;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON3, 0, 1, 2}, + {"\033[163;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON4, 0, 1, 2}, + + {"\033[<0;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, 0, 1, 2}, + {"\033[<1;61;19M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, 0, 61, 19}, + {"\033[<2;6115;1559M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, 0, 6115, 1559}, + {"\033[<4;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[<5;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[<6;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[<8;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_META, 5, 6}, + {"\033[<9;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_META, 5, 6}, + {"\033[<10;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_META, 5, 6}, + {"\033[<12;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_META | LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[<13;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_META | LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[<14;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_META | LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[<16;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_CTRL, 5, 6}, + {"\033[<17;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_CTRL, 5, 6}, + {"\033[<18;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_CTRL, 5, 6}, + {"\033[<20;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_CTRL | LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[<21;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_CTRL | LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[<22;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_CTRL | LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[<24;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_CTRL | LIBTERMINPUT_META, 5, 6}, + {"\033[<25;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_CTRL | LIBTERMINPUT_META, 5, 6}, + {"\033[<26;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_CTRL | LIBTERMINPUT_META, 5, 6}, + {"\033[<32;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_BUTTON1, 0, 5, 6}, + {"\033[<33;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_BUTTON2, 0, 5, 6}, + {"\033[<34;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_BUTTON3, 0, 5, 6}, + {"\033[<35;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_NO_BUTTON, 0, 5, 6}, + {"\033[<36;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[<37;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[<38;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[<39;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_NO_BUTTON, LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[<64;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_SCROLL_UP, 0, 1, 2}, + {"\033[<65;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_SCROLL_DOWN, 0, 1, 2}, + {"\033[<66;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_SCROLL_LEFT, 0, 1, 2}, + {"\033[<67;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_SCROLL_RIGHT, 0, 1, 2}, + {"\033[<128;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON1, 0, 1, 2}, + {"\033[<129;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON2, 0, 1, 2}, + {"\033[<130;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON3, 0, 1, 2}, + {"\033[<131;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON4, 0, 1, 2}, + + {"\033[<0;1;2m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, 0, 1, 2}, + {"\033[<1;61;19m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON2, 0, 61, 19}, + {"\033[<2;6115;1559m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON3, 0, 6115, 1559}, + {"\033[<4;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[<5;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[<6;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[<8;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_META, 5, 6}, + {"\033[<9;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_META, 5, 6}, + {"\033[<10;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_META, 5, 6}, + {"\033[<12;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_META | LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[<13;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_META | LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[<14;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_META | LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[<16;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_CTRL, 5, 6}, + {"\033[<17;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_CTRL, 5, 6}, + {"\033[<18;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_CTRL, 5, 6}, + {"\033[<20;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_CTRL | LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[<21;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_CTRL | LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[<22;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_CTRL | LIBTERMINPUT_SHIFT, 5, 6}, + {"\033[<24;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_CTRL | LIBTERMINPUT_META, 5, 6}, + {"\033[<25;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_CTRL | LIBTERMINPUT_META, 5, 6}, + {"\033[<26;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_CTRL | LIBTERMINPUT_META, 5, 6}, + {"\033[<66;1;2m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_SCROLL_LEFT, 0, 1, 2}, + {"\033[<67;1;2m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_SCROLL_RIGHT, 0, 1, 2}, + {"\033[<128;1;2m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_XBUTTON1, 0, 1, 2}, + {"\033[<129;1;2m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_XBUTTON2, 0, 1, 2}, + {"\033[<130;1;2m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_XBUTTON3, 0, 1, 2}, + {"\033[<131;1;2m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_XBUTTON4, 0, 1, 2}, + + {NULL, 0, 0, 0, 0, 0} +}; + int main(void) @@ -479,129 +601,105 @@ main(void) TEST(input.keypress.times == 1); TEST(!strcmp(input.keypress.symbol, " ")); - MOUSE("\033[32;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, 0, 1, 2); - MOUSE("\033[33;61;19M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, 0, 61, 19); - MOUSE("\033[34;6115;1559M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, 0, 6115, 1559); - MOUSE("\033[35;0;0M", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, 0, 1, 1); - MOUSE("\033[36;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[37;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[38;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[39;5;6M", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[40;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_META, 5, 6); - MOUSE("\033[41;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_META, 5, 6); - MOUSE("\033[42;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_META, 5, 6); - MOUSE("\033[43;5;6M", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_META, 5, 6); - MOUSE("\033[44;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_META | LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[45;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_META | LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[46;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_META | LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[47;5;6M", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_META | LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[48;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_CTRL, 5, 6); - MOUSE("\033[49;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_CTRL, 5, 6); - MOUSE("\033[50;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_CTRL, 5, 6); - MOUSE("\033[51;5;6M", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_CTRL, 5, 6); - MOUSE("\033[52;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_CTRL | LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[53;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_CTRL | LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[54;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_CTRL | LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[55;5;6M", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_CTRL | LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[56;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_CTRL | LIBTERMINPUT_META, 5, 6); - MOUSE("\033[57;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_CTRL | LIBTERMINPUT_META, 5, 6); - MOUSE("\033[58;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_CTRL | LIBTERMINPUT_META, 5, 6); - MOUSE("\033[59;5;6M", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_CTRL | LIBTERMINPUT_META, 5, 6); - MOUSE("\033[64;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_BUTTON1, 0, 5, 6); - MOUSE("\033[65;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_BUTTON2, 0, 5, 6); - MOUSE("\033[66;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_BUTTON3, 0, 5, 6); - MOUSE("\033[67;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_NO_BUTTON, 0, 5, 6); - MOUSE("\033[68;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[69;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[70;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[71;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_NO_BUTTON, LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[96;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_SCROLL_UP, 0, 1, 2); - MOUSE("\033[97;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_SCROLL_DOWN, 0, 1, 2); - MOUSE("\033[98;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_SCROLL_LEFT, 0, 1, 2); - MOUSE("\033[99;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_SCROLL_RIGHT, 0, 1, 2); - MOUSE("\033[160;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON1, 0, 1, 2); - MOUSE("\033[161;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON2, 0, 1, 2); - MOUSE("\033[162;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON3, 0, 1, 2); - MOUSE("\033[163;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON4, 0, 1, 2); - - MOUSE("\033[<0;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, 0, 1, 2); - MOUSE("\033[<1;61;19M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, 0, 61, 19); - MOUSE("\033[<2;6115;1559M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, 0, 6115, 1559); - MOUSE("\033[<4;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[<5;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[<6;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[<8;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_META, 5, 6); - MOUSE("\033[<9;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_META, 5, 6); - MOUSE("\033[<10;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_META, 5, 6); - MOUSE("\033[<12;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_META | LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[<13;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_META | LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[<14;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_META | LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[<16;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_CTRL, 5, 6); - MOUSE("\033[<17;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_CTRL, 5, 6); - MOUSE("\033[<18;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_CTRL, 5, 6); - MOUSE("\033[<20;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_CTRL | LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[<21;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_CTRL | LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[<22;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_CTRL | LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[<24;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_CTRL | LIBTERMINPUT_META, 5, 6); - MOUSE("\033[<25;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_CTRL | LIBTERMINPUT_META, 5, 6); - MOUSE("\033[<26;5;6M", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_CTRL | LIBTERMINPUT_META, 5, 6); - MOUSE("\033[<32;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_BUTTON1, 0, 5, 6); - MOUSE("\033[<33;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_BUTTON2, 0, 5, 6); - MOUSE("\033[<34;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_BUTTON3, 0, 5, 6); - MOUSE("\033[<35;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_NO_BUTTON, 0, 5, 6); - MOUSE("\033[<36;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[<37;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[<38;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[<39;5;6M", LIBTERMINPUT_MOTION, LIBTERMINPUT_NO_BUTTON, LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[<64;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_SCROLL_UP, 0, 1, 2); - MOUSE("\033[<65;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_SCROLL_DOWN, 0, 1, 2); - MOUSE("\033[<66;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_SCROLL_LEFT, 0, 1, 2); - MOUSE("\033[<67;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_SCROLL_RIGHT, 0, 1, 2); - MOUSE("\033[<128;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON1, 0, 1, 2); - MOUSE("\033[<129;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON2, 0, 1, 2); - MOUSE("\033[<130;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON3, 0, 1, 2); - MOUSE("\033[<131;1;2M", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON4, 0, 1, 2); - - MOUSE("\033[<0;1;2m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, 0, 1, 2); - MOUSE("\033[<1;61;19m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON2, 0, 61, 19); - MOUSE("\033[<2;6115;1559m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON3, 0, 6115, 1559); - MOUSE("\033[<4;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[<5;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[<6;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[<8;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_META, 5, 6); - MOUSE("\033[<9;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_META, 5, 6); - MOUSE("\033[<10;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_META, 5, 6); - MOUSE("\033[<12;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_META | LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[<13;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_META | LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[<14;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_META | LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[<16;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_CTRL, 5, 6); - MOUSE("\033[<17;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_CTRL, 5, 6); - MOUSE("\033[<18;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_CTRL, 5, 6); - MOUSE("\033[<20;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_CTRL | LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[<21;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_CTRL | LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[<22;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_CTRL | LIBTERMINPUT_SHIFT, 5, 6); - MOUSE("\033[<24;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, LIBTERMINPUT_CTRL | LIBTERMINPUT_META, 5, 6); - MOUSE("\033[<25;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON2, LIBTERMINPUT_CTRL | LIBTERMINPUT_META, 5, 6); - MOUSE("\033[<26;5;6m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON3, LIBTERMINPUT_CTRL | LIBTERMINPUT_META, 5, 6); - MOUSE("\033[<66;1;2m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_SCROLL_LEFT, 0, 1, 2); - MOUSE("\033[<67;1;2m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_SCROLL_RIGHT, 0, 1, 2); - MOUSE("\033[<128;1;2m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_XBUTTON1, 0, 1, 2); - MOUSE("\033[<129;1;2m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_XBUTTON2, 0, 1, 2); - MOUSE("\033[<130;1;2m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_XBUTTON3, 0, 1, 2); - MOUSE("\033[<131;1;2m", LIBTERMINPUT_RELEASE, LIBTERMINPUT_XBUTTON4, 0, 1, 2); - - MOUSE("\033[M !#", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, 0, 1, 3); - MOUSE("\033[M!#!", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, 0, 3, 1); - MOUSE("\033[M\"#!", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, 0, 3, 1); - MOUSE("\033[M#!#", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, 0, 1, 3); -#ifdef TODO - MOUSE("\033[\x80 !#", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON1, 0, 1, 3); - MOUSE("\033[\x84 !#", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON1, LIBTERMINPUT_SHIFT, 1, 3); - MOUSE("\033[\x88 !#", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON1, LIBTERMINPUT_META, 1, 3); - MOUSE("\033[\x8C !#", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON1, LIBTERMINPUT_SHIFT | LIBTERMINPUT_META, 1, 3); - MOUSE("\033[\x90 !#", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON1, LIBTERMINPUT_CTRL, 1, 3); - MOUSE("\033[\x91 !#", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON2, LIBTERMINPUT_CTRL, 1, 3); -#endif + for (i = 0; mice[i].str; i++) + MOUSE(mice[i].str, mice[i].event, mice[i].button, mice[i].mods, mice[i].x, mice[i].y); + + MOUSE("\033[M !#", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, 0, 1, 3); + MOUSE("\033[M!#!", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, 0, 3, 1); + MOUSE("\033[M\"#!", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, 0, 3, 1); + MOUSE("\033[M#!#", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, 0, 1, 3); + MOUSE("\033[M\xa0!#" , LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON1, 0, 1, 3); + MOUSE("\033[M\xa4!#", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON1, LIBTERMINPUT_SHIFT, 1, 3); + MOUSE("\033[M\xa8!#", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON1, LIBTERMINPUT_META, 1, 3); + MOUSE("\033[M\xac!#", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON1, LIBTERMINPUT_SHIFT | LIBTERMINPUT_META, 1, 3); + MOUSE("\033[M\xb0!#", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON1, LIBTERMINPUT_CTRL, 1, 3); + MOUSE("\033[M\xb1!#", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON2, LIBTERMINPUT_CTRL, 1, 3); + MOUSE("\033[M ", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, 0, 1, 1); + + MOUSE("\033[M\xdf\xff\xff", LIBTERMINPUT_MOTION, 11, 7, 255 - 32, 255 - 32); + MOUSE("\033[M\x1f\x1f\x1f", LIBTERMINPUT_MOTION, 15, 7, 255, 255); + + TYPE("\033[M", LIBTERMINPUT_NONE); + MOUSE("!#!", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, 0, 3, 1); + TYPE("\033[M!", LIBTERMINPUT_NONE); + MOUSE("#!", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, 0, 3, 1); + TYPE("\033[M!#", LIBTERMINPUT_NONE); + MOUSE("!", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, 0, 3, 1); + + libterminput_set_flags(&ctx, LIBTERMINPUT_DECSET_1005); + + MOUSE("\033[M !#", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, 0, 1, 3); + MOUSE("\033[M!#!", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON2, 0, 3, 1); + MOUSE("\033[M\"#!", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON3, 0, 3, 1); + MOUSE("\033[M#!#", LIBTERMINPUT_RELEASE, LIBTERMINPUT_BUTTON1, 0, 1, 3); + MOUSE("\033[M\xc2\xa0!#" , LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON1, 0, 1, 3); + MOUSE("\033[M\xc2\xa4!#", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON1, LIBTERMINPUT_SHIFT, 1, 3); + MOUSE("\033[M\xc2\xa8!#", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON1, LIBTERMINPUT_META, 1, 3); + MOUSE("\033[M\xc2\xac!#", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON1, LIBTERMINPUT_SHIFT | LIBTERMINPUT_META, 1, 3); + MOUSE("\033[M\xc2\xb0!#", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON1, LIBTERMINPUT_CTRL, 1, 3); + MOUSE("\033[M\xc2\xb1!#", LIBTERMINPUT_PRESS, LIBTERMINPUT_XBUTTON2, LIBTERMINPUT_CTRL, 1, 3); + MOUSE("\033[M ", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, 0, 1, 1); + + TYPE("\033[M \x1f", LIBTERMINPUT_KEYPRESS); + TEST(input.keypress.key == LIBTERMINPUT_MACRO); + TEST(input.keypress.mods == 0); + TEST(input.keypress.times == 1); + TYPE(NULL, LIBTERMINPUT_KEYPRESS); + TEST(input.keypress.key == LIBTERMINPUT_SYMBOL); + TEST(input.keypress.mods == 0); + TEST(input.keypress.times == 1); + TEST(!strcmp(input.keypress.symbol, " ")); + TYPE(NULL, LIBTERMINPUT_KEYPRESS); + TEST(input.keypress.key == LIBTERMINPUT_SYMBOL); + TEST(input.keypress.mods == 0); + TEST(input.keypress.times == 1); + TEST(!strcmp(input.keypress.symbol, " ")); + TYPE(NULL, LIBTERMINPUT_KEYPRESS); + TEST(input.keypress.key == LIBTERMINPUT_SYMBOL); + TEST(input.keypress.mods == LIBTERMINPUT_CTRL); + TEST(input.keypress.times == 1); + TEST(!strcmp(input.keypress.symbol, "_")); + TYPE("\033[M \x1f ", LIBTERMINPUT_KEYPRESS); + TYPE(NULL, LIBTERMINPUT_KEYPRESS); + TYPE(NULL, LIBTERMINPUT_KEYPRESS); + TYPE(NULL, LIBTERMINPUT_KEYPRESS); + TYPE("\033[M\x1f ", LIBTERMINPUT_KEYPRESS); + TYPE(NULL, LIBTERMINPUT_KEYPRESS); + TYPE(NULL, LIBTERMINPUT_KEYPRESS); + TYPE(NULL, LIBTERMINPUT_KEYPRESS); + + MOUSE("\033[M \xc6\x89#", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, 0, 361, 3); + MOUSE("\033[M #\xc6\x89", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, 0, 3, 361); + MOUSE("\033[M \xc6\x89\xe0\xb4\xa5", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, 0, 361, 3333); + + TYPE("\033[M\xff", LIBTERMINPUT_KEYPRESS); + TEST(input.keypress.key == LIBTERMINPUT_MACRO); + TEST(input.keypress.mods == 0); + TEST(input.keypress.times == 1); + TYPE(NULL, LIBTERMINPUT_KEYPRESS); + TYPE("\033[M!\xff", LIBTERMINPUT_KEYPRESS); + TEST(input.keypress.key == LIBTERMINPUT_MACRO); + TEST(input.keypress.mods == 0); + TEST(input.keypress.times == 1); + TYPE(NULL, LIBTERMINPUT_KEYPRESS); + TYPE(NULL, LIBTERMINPUT_KEYPRESS); + TYPE("\033[M!!\xff", LIBTERMINPUT_KEYPRESS); + TEST(input.keypress.key == LIBTERMINPUT_MACRO); + TEST(input.keypress.mods == 0); + TEST(input.keypress.times == 1); + TYPE(NULL, LIBTERMINPUT_KEYPRESS); + TYPE(NULL, LIBTERMINPUT_KEYPRESS); + TYPE(NULL, LIBTERMINPUT_KEYPRESS); + + TYPE("\033[M", LIBTERMINPUT_NONE); + TYPE(" ", LIBTERMINPUT_NONE); + TYPE("\xc6", LIBTERMINPUT_NONE); + TYPE("\x89", LIBTERMINPUT_NONE); + TYPE("\xe0", LIBTERMINPUT_NONE); + TYPE("\xb4", LIBTERMINPUT_NONE); + MOUSE("\xa5", LIBTERMINPUT_PRESS, LIBTERMINPUT_BUTTON1, 0, 361, 3333); + + libterminput_clear_flags(&ctx, LIBTERMINPUT_DECSET_1005); close(fds[1]); TEST(libterminput_read(fds[0], &input, &ctx) == 0); |