[PATCH libinput 3/6] evdev: add support for middle button emulation

Peter Hutterer peter.hutterer at who-t.net
Tue Apr 14 20:51:15 PDT 2015


This is just the required framework, it's not hooked up to anything just yet.
Hooking it up comes as separate commit to better detail why/when a device
supports emulation.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 doc/Makefile.am                 |    5 +-
 doc/middle-button-emulation.svg | 1315 +++++++++++++++++++++++++++++++++++++++
 src/Makefile.am                 |    1 +
 src/evdev-middle-button.c       |  673 ++++++++++++++++++++
 src/evdev.c                     |    6 +
 src/evdev.h                     |   46 ++
 test/litest.c                   |    6 +
 test/litest.h                   |    1 +
 test/touchpad.c                 |    3 +
 9 files changed, 2055 insertions(+), 1 deletion(-)
 create mode 100644 doc/middle-button-emulation.svg
 create mode 100644 src/evdev-middle-button.c

diff --git a/doc/Makefile.am b/doc/Makefile.am
index f66b47f..6e6f72d 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,4 +1,7 @@
-EXTRA_DIST = touchpad-tap-state-machine.svg touchpad-softbutton-state-machine.svg
+EXTRA_DIST = \
+	     middle-button-emulation.svg \
+	     touchpad-tap-state-machine.svg \
+	     touchpad-softbutton-state-machine.svg
 
 if BUILD_DOCS
 
diff --git a/doc/middle-button-emulation.svg b/doc/middle-button-emulation.svg
new file mode 100644
index 0000000..338af38
--- /dev/null
+++ b/doc/middle-button-emulation.svg
@@ -0,0 +1,1315 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1674px" height="2151px" version="1.1">
+  <defs/>
+  <g transform="translate(0.5,0.5)">
+    <ellipse cx="748" cy="32" rx="50" ry="30" fill="#ccccff" stroke="#000000" stroke-width="2" pointer-events="none"/>
+    <g transform="translate(729,25)">
+      <switch>
+	<foreignObject pointer-events="all" width="38" height="17" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 38px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      IDLE<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="19" y="15" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 429.17 99 C 432.06 95.86 436.17 94.05 440.5 94 L 475.51 94 C 479.84 94.05 483.95 95.86 486.84 99 L 507.43 122 C 508.01 123.28 508.01 124.72 507.43 126 L 486.84 149 C 483.95 152.14 479.84 153.95 475.51 154 L 440.5 154 C 436.17 153.95 432.06 152.14 429.17 149 L 408.58 126 C 408 124.72 408 123.28 408.58 122 L 429.17 99 Z" fill="#ffd966" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(425,110)">
+      <switch>
+	<foreignObject pointer-events="all" width="65" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 65px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      left button<br />
+	      press<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="33" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1009.17 99 C 1012.06 95.86 1016.17 94.05 1020.5 94 L 1055.51 94 C 1059.84 94.05 1063.95 95.86 1066.84 99 L 1087.43 122 C 1088.01 123.28 1088.01 124.72 1087.43 126 L 1066.84 149 C 1063.95 152.14 1059.84 153.95 1055.51 154 L 1020.5 154 C 1016.17 153.95 1012.06 152.14 1009.17 149 L 988.58 126 C 988 124.72 988 123.28 988.58 122 L 1009.17 99 Z" fill="#9ac7bf" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(1002,110)">
+      <switch>
+	<foreignObject pointer-events="all" width="71" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 71px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      right button<br />
+	      press<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="36" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 729.17 239 C 732.06 235.86 736.17 234.05 740.5 234 L 775.51 234 C 779.84 234.05 783.95 235.86 786.84 239 L 807.43 262 C 808.01 263.28 808.01 264.72 807.43 266 L 786.84 289 C 783.95 292.14 779.84 293.95 775.51 294 L 740.5 294 C 736.17 293.95 732.06 292.14 729.17 289 L 708.58 266 C 708 264.72 708 263.28 708.58 262 L 729.17 239 Z" fill="#ffffff" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(720,250)">
+      <switch>
+	<foreignObject pointer-events="all" width="75" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 75px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      other button<br />
+	      press<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="38" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 749 62 L 756.7 227.64" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 756.95 232.88 L 753.13 226.05 L 756.7 227.64 L 760.12 225.73 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 698 48 L 514.07 106.08" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 509.07 107.66 L 514.69 102.22 L 514.07 106.08 L 516.8 108.89 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 798 48 L 981.93 106.08" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 986.93 107.66 L 979.2 108.89 L 981.93 106.08 L 981.31 102.22 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <ellipse cx="398" cy="224" rx="50" ry="30" fill="#ccccff" stroke="#000000" stroke-width="2" pointer-events="none"/>
+    <g transform="translate(355,217)">
+      <switch>
+	<foreignObject pointer-events="all" width="85" height="17" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 85px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      LEFT_DOWN</div>
+	  </div>
+	</foreignObject>
+	<text x="43" y="15" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 440 154 L 419.28 188.54" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 416.58 193.04 L 417.18 185.24 L 419.28 188.54 L 423.18 188.84 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <ellipse cx="1068" cy="224" rx="50" ry="30" fill="#ccccff" stroke="#000000" stroke-width="2" pointer-events="none"/>
+    <g transform="translate(1021,217)">
+      <switch>
+	<foreignObject pointer-events="all" width="93" height="17" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 93px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      RIGHT_DOWN</div>
+	  </div>
+	</foreignObject>
+	<text x="47" y="15" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <ellipse cx="748" cy="604" rx="50" ry="30" fill="#ccccff" stroke="#000000" stroke-width="2" pointer-events="none"/>
+    <g transform="translate(697,597)">
+      <switch>
+	<foreignObject pointer-events="all" width="102" height="17" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 102px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      PASSTHROUGH</div>
+	  </div>
+	</foreignObject>
+	<text x="51" y="15" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1047 154 L 1057.17 187.9" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1058.68 192.93 L 1053.31 187.23 L 1057.17 187.9 L 1060.02 185.22 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 209.17 329 C 212.06 325.86 216.17 324.05 220.5 324 L 255.51 324 C 259.84 324.05 263.95 325.86 266.84 329 L 287.43 352 C 288.01 353.28 288.01 354.72 287.43 356 L 266.84 379 C 263.95 382.14 259.84 383.95 255.51 384 L 220.5 384 C 216.17 383.95 212.06 382.14 209.17 379 L 188.58 356 C 188 354.72 188 353.28 188.58 352 L 209.17 329 Z" fill="#ffd966" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(205,340)">
+      <switch>
+	<foreignObject pointer-events="all" width="65" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 65px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      left button<br />
+	      release<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="33" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 361 254 L 279.94 319.98" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 275.87 323.29 L 279.09 316.16 L 279.94 319.98 L 283.51 321.59 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 329.17 339 C 332.06 335.86 336.17 334.05 340.5 334 L 375.51 334 C 379.84 334.05 383.95 335.86 386.84 339 L 407.43 362 C 408.01 363.28 408.01 364.72 407.43 366 L 386.84 389 C 383.95 392.14 379.84 393.95 375.51 394 L 340.5 394 C 336.17 393.95 332.06 392.14 329.17 389 L 308.58 366 C 308 364.72 308 363.28 308.58 362 L 329.17 339 Z" fill="#9ac7bf" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(322,350)">
+      <switch>
+	<foreignObject pointer-events="all" width="71" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 71px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      right button<br />
+	      press<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="36" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 390 254 L 368.76 327.88" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 367.31 332.93 L 365.88 325.23 L 368.76 327.88 L 372.61 327.17 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 479.17 339 C 482.06 335.86 486.17 334.05 490.5 334 L 525.51 334 C 529.84 334.05 533.95 335.86 536.84 339 L 557.43 362 C 558.01 363.28 558.01 364.72 557.43 366 L 536.84 389 C 533.95 392.14 529.84 393.95 525.51 394 L 490.5 394 C 486.17 393.95 482.06 392.14 479.17 389 L 458.58 366 C 458 364.72 458 363.28 458.58 362 L 479.17 339 Z" fill="#ffffff" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(482,357)">
+      <switch>
+	<foreignObject pointer-events="all" width="51" height="17" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 51px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      timeout</div>
+	  </div>
+	</foreignObject>
+	<text x="26" y="15" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 421 254 L 480.06 329" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 483.31 333.12 L 476.23 329.79 L 480.06 329 L 481.73 325.46 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 448 236 L 551.8 260.54" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 556.91 261.74 L 549.29 263.54 L 551.8 260.54 L 550.9 256.73 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 147.61 409.1 C 148.78 405.9 150.67 404.04 152.67 404.12 L 222.53 404.12 C 224.13 404.08 225.65 404.63 226.65 405.61 C 227.64 406.59 227.99 407.88 227.6 409.1 L 208.36 458.9 C 207.19 462.1 205.3 463.96 203.3 463.88 L 132.42 463.88 C 131.01 463.69 129.77 463.05 128.99 462.1 C 128.22 461.15 128 459.99 128.37 458.9 Z" fill="#ea6b66" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(142,420)">
+      <switch>
+	<foreignObject pointer-events="all" width="71" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 71px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      BTN_LEFT<br />
+	      PRESS<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="36" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 47.61 499.1 C 48.78 495.9 50.67 494.04 52.67 494.12 L 122.53 494.12 C 124.13 494.08 125.65 494.63 126.65 495.61 C 127.64 496.59 127.99 497.88 127.6 499.1 L 108.36 548.9 C 107.19 552.1 105.3 553.96 103.3 553.88 L 32.42 553.88 C 31.01 553.69 29.77 553.05 28.99 552.1 C 28.22 551.15 28 549.99 28.37 548.9 Z" fill="#ea6b66" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(42,510)">
+      <switch>
+	<foreignObject pointer-events="all" width="71" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 71px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      BTN_LEFT<br />
+	      RELEASE<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="36" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 216 384 L 204.82 398.91" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 201.67 403.11 L 203.07 395.41 L 204.82 398.91 L 208.67 399.61 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 145 464 L 115.77 489.79" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 111.84 493.26 L 114.77 486 L 115.77 489.79 L 119.4 491.25 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 517.61 429.1 C 518.78 425.9 520.67 424.04 522.67 424.12 L 592.53 424.12 C 594.13 424.08 595.65 424.63 596.65 425.61 C 597.64 426.59 597.99 427.88 597.6 429.1 L 578.36 478.9 C 577.19 482.1 575.3 483.96 573.3 483.88 L 502.42 483.88 C 501.01 483.69 499.77 483.05 498.99 482.1 C 498.22 481.15 498 479.99 498.37 478.9 Z" fill="#ea6b66" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(512,440)">
+      <switch>
+	<foreignObject pointer-events="all" width="71" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 71px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      BTN_LEFT<br />
+	      PRESS<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="36" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 528 394 L 544.47 418.7" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 547.38 423.07 L 540.58 419.19 L 544.47 418.7 L 546.41 415.3 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <ellipse cx="808" cy="894" rx="50" ry="30" fill="#ccccff" stroke="#000000" stroke-width="2" pointer-events="none"/>
+    <g transform="translate(779,887)">
+      <switch>
+	<foreignObject pointer-events="all" width="57" height="17" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 57px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      MIDDLE</div>
+	  </div>
+	</foreignObject>
+	<text x="29" y="15" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 767.61 719.1 C 768.78 715.9 770.67 714.04 772.67 714.12 L 842.53 714.12 C 844.13 714.08 845.65 714.63 846.65 715.61 C 847.64 716.59 847.99 717.88 847.6 719.1 L 828.36 768.9 C 827.19 772.1 825.3 773.96 823.3 773.88 L 752.42 773.88 C 751.01 773.69 749.77 773.05 748.99 772.1 C 748.22 771.15 748 769.99 748.37 768.9 Z" fill="#ea6b66" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(754,730)">
+      <switch>
+	<foreignObject pointer-events="all" width="87" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 87px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      BTN_MIDDLE<br />
+	      PRESS<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="44" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 393 394 L 758.18 709.83" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 762.15 713.27 L 754.57 711.34 L 758.18 709.83 L 759.15 706.04 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 800 774 L 805.58 857.65" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 805.93 862.88 L 801.97 856.13 L 805.58 857.65 L 808.95 855.67 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 709.17 989 C 712.06 985.86 716.17 984.05 720.5 984 L 755.51 984 C 759.84 984.05 763.95 985.86 766.84 989 L 787.43 1012 C 788.01 1013.28 788.01 1014.72 787.43 1016 L 766.84 1039 C 763.95 1042.14 759.84 1043.95 755.51 1044 L 720.5 1044 C 716.17 1043.95 712.06 1042.14 709.17 1039 L 688.58 1016 C 688 1014.72 688 1013.28 688.58 1012 L 709.17 989 Z" fill="#ffd966" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(705,1000)">
+      <switch>
+	<foreignObject pointer-events="all" width="65" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 65px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      left button<br />
+	      release<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="33" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 849.17 989 C 852.06 985.86 856.17 984.05 860.5 984 L 895.51 984 C 899.84 984.05 903.95 985.86 906.84 989 L 927.43 1012 C 928.01 1013.28 928.01 1014.72 927.43 1016 L 906.84 1039 C 903.95 1042.14 899.84 1043.95 895.51 1044 L 860.5 1044 C 856.17 1043.95 852.06 1042.14 849.17 1039 L 828.58 1016 C 828 1014.72 828 1013.28 828.58 1012 L 849.17 989 Z" fill="#9ac7bf" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(842,1000)">
+      <switch>
+	<foreignObject pointer-events="all" width="71" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 71px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      right button<br />
+	      release<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="36" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 826 924 L 857.79 978.5" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 860.44 983.03 L 853.89 978.75 L 857.79 978.5 L 859.93 975.22 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 791 924 L 759.21 978.5" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 756.56 983.03 L 757.07 975.22 L 759.21 978.5 L 763.11 978.75 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 857.61 1109.1 C 858.78 1105.9 860.67 1104.04 862.67 1104.12 L 932.53 1104.12 C 934.13 1104.08 935.65 1104.63 936.65 1105.61 C 937.64 1106.59 937.99 1107.88 937.6 1109.1 L 918.36 1158.9 C 917.19 1162.1 915.3 1163.96 913.3 1163.88 L 842.42 1163.88 C 841.01 1163.69 839.77 1163.05 838.99 1162.1 C 838.22 1161.15 838 1159.99 838.37 1158.9 Z" fill="#ea6b66" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(844,1120)">
+      <switch>
+	<foreignObject pointer-events="all" width="87" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 87px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      BTN_MIDDLE<br />
+	      RELEASE<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="44" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 707.61 1109.1 C 708.78 1105.9 710.67 1104.04 712.67 1104.12 L 782.53 1104.12 C 784.13 1104.08 785.65 1104.63 786.65 1105.61 C 787.64 1106.59 787.99 1107.88 787.6 1109.1 L 768.36 1158.9 C 767.19 1162.1 765.3 1163.96 763.3 1163.88 L 692.42 1163.88 C 691.01 1163.69 689.77 1163.05 688.99 1162.1 C 688.22 1161.15 688 1159.99 688.37 1158.9 Z" fill="#ea6b66" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(694,1120)">
+      <switch>
+	<foreignObject pointer-events="all" width="87" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 87px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      BTN_MIDDLE<br />
+	      RELEASE<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="44" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 738 1044 L 738 1097.63" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 738 1102.88 L 734.5 1095.88 L 738 1097.63 L 741.5 1095.88 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 881 1044 L 885.47 1097.65" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 885.91 1102.89 L 881.84 1096.2 L 885.47 1097.65 L 888.81 1095.62 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <ellipse cx="888" cy="1224" rx="50" ry="30" fill="#ccccff" stroke="#000000" stroke-width="2" pointer-events="none"/>
+    <g transform="translate(840,1217)">
+      <switch>
+	<foreignObject pointer-events="all" width="95" height="17" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 95px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      LUP_PENDING</div>
+	  </div>
+	</foreignObject>
+	<text x="48" y="15" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <ellipse cx="738" cy="1224" rx="50" ry="30" fill="#ccccff" stroke="#000000" stroke-width="2" pointer-events="none"/>
+    <g transform="translate(689,1217)">
+      <switch>
+	<foreignObject pointer-events="all" width="97" height="17" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 97px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      RUP_PENDING</div>
+	  </div>
+	</foreignObject>
+	<text x="49" y="15" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 738 1164 L 738 1187.63" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 738 1192.88 L 734.5 1185.88 L 738 1187.63 L 741.5 1185.88 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 888 1164 L 888 1187.63" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 888 1192.88 L 884.5 1185.88 L 888 1187.63 L 891.5 1185.88 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 829.17 1319 C 832.06 1315.86 836.17 1314.05 840.5 1314 L 875.51 1314 C 879.84 1314.05 883.95 1315.86 886.84 1319 L 907.43 1342 C 908.01 1343.28 908.01 1344.72 907.43 1346 L 886.84 1369 C 883.95 1372.14 879.84 1373.95 875.51 1374 L 840.5 1374 C 836.17 1373.95 832.06 1372.14 829.17 1369 L 808.58 1346 C 808 1344.72 808 1343.28 808.58 1342 L 829.17 1319 Z" fill="#ffd966" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(825,1330)">
+      <switch>
+	<foreignObject pointer-events="all" width="65" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 65px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      left button<br />
+	      release<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="33" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 719.17 1319 C 722.06 1315.86 726.17 1314.05 730.5 1314 L 765.51 1314 C 769.84 1314.05 773.95 1315.86 776.84 1319 L 797.43 1342 C 798.01 1343.28 798.01 1344.72 797.43 1346 L 776.84 1369 C 773.95 1372.14 769.84 1373.95 765.51 1374 L 730.5 1374 C 726.17 1373.95 722.06 1372.14 719.17 1369 L 698.58 1346 C 698 1344.72 698 1343.28 698.58 1342 L 719.17 1319 Z" fill="#9ac7bf" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(712,1330)">
+      <switch>
+	<foreignObject pointer-events="all" width="71" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 71px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      right button<br />
+	      release<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="36" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 741 1254 L 745.47 1307.65" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 745.91 1312.89 L 741.84 1306.2 L 745.47 1307.65 L 748.81 1305.62 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 881 1254 L 867.54 1307.82" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 866.27 1312.92 L 864.57 1305.28 L 867.54 1307.82 L 871.36 1306.97 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <ellipse cx="808" cy="1454" rx="50" ry="30" fill="#ccccff" stroke="#000000" stroke-width="2" pointer-events="none"/>
+    <g transform="translate(789,1447)">
+      <switch>
+	<foreignObject pointer-events="all" width="38" height="17" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 38px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      IDLE<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="19" y="15" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 765 1374 L 788.97 1418.4" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 791.47 1423.02 L 785.06 1418.52 L 788.97 1418.4 L 791.22 1415.19 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 845 1374 L 824.66 1418.21" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 822.47 1422.98 L 822.21 1415.16 L 824.66 1418.21 L 828.57 1418.09 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1009.17 1089 C 1012.06 1085.86 1016.17 1084.05 1020.5 1084 L 1055.51 1084 C 1059.84 1084.05 1063.95 1085.86 1066.84 1089 L 1087.43 1112 C 1088.01 1113.28 1088.01 1114.72 1087.43 1116 L 1066.84 1139 C 1063.95 1142.14 1059.84 1143.95 1055.51 1144 L 1020.5 1144 C 1016.17 1143.95 1012.06 1142.14 1009.17 1139 L 988.58 1116 C 988 1114.72 988 1113.28 988.58 1112 L 1009.17 1089 Z" fill="#9ac7bf" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(1002,1100)">
+      <switch>
+	<foreignObject pointer-events="all" width="71" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 71px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      right button<br />
+	      press<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="36" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 929 1194 L 991.87 1147.77" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 996.1 1144.66 L 992.53 1151.63 L 991.87 1147.77 L 988.39 1145.99 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1019 1084 L 820.48 779.34" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 817.61 774.94 L 824.36 778.89 L 820.48 779.34 L 818.5 782.71 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 545.17 1089 C 548.06 1085.86 552.17 1084.05 556.5 1084 L 591.51 1084 C 595.84 1084.05 599.95 1085.86 602.84 1089 L 623.43 1112 C 624.01 1113.28 624.01 1114.72 623.43 1116 L 602.84 1139 C 599.95 1142.14 595.84 1143.95 591.51 1144 L 556.5 1144 C 552.17 1143.95 548.06 1142.14 545.17 1139 L 524.58 1116 C 524 1114.72 524 1113.28 524.58 1112 L 545.17 1089 Z" fill="#ffd966" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(541,1100)">
+      <switch>
+	<foreignObject pointer-events="all" width="65" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 65px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      left button<br />
+	      press<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="33" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 693 1194 L 624.28 1147.57" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 619.93 1144.63 L 627.69 1145.64 L 624.28 1147.57 L 623.77 1151.44 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 592 1084 L 776.7 779.44" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 779.42 774.96 L 778.78 782.76 L 776.7 779.44 L 772.8 779.13 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 78 494 L 78 42 Q 78 32 88 32 L 691.63 32" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 696.88 32 L 689.88 35.5 L 691.63 32 L 689.88 28.5 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 579.17 249 C 582.06 245.86 586.17 244.05 590.5 244 L 625.51 244 C 629.84 244.05 633.95 245.86 636.84 249 L 657.43 272 C 658.01 273.28 658.01 274.72 657.43 276 L 636.84 299 C 633.95 302.14 629.84 303.95 625.51 304 L 590.5 304 C 586.17 303.95 582.06 302.14 579.17 299 L 558.58 276 C 558 274.72 558 273.28 558.58 272 L 579.17 249 Z" fill="#ffffff" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(570,260)">
+      <switch>
+	<foreignObject pointer-events="all" width="75" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 75px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      other button<br />
+	      press<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="38" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 588 484 L 702.91 570.18" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 707.11 573.33 L 699.41 571.93 L 702.91 570.18 L 703.61 566.33 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1109.17 349 C 1112.06 345.86 1116.17 344.05 1120.5 344 L 1155.51 344 C 1159.84 344.05 1163.95 345.86 1166.84 349 L 1187.43 372 C 1188.01 373.28 1188.01 374.72 1187.43 376 L 1166.84 399 C 1163.95 402.14 1159.84 403.95 1155.51 404 L 1120.5 404 C 1116.17 403.95 1112.06 402.14 1109.17 399 L 1088.58 376 C 1088 374.72 1088 373.28 1088.58 372 L 1109.17 349 Z" fill="#ffd966" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(1105,360)">
+      <switch>
+	<foreignObject pointer-events="all" width="65" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 65px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      left button<br />
+	      press<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="33" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1249.17 349 C 1252.06 345.86 1256.17 344.05 1260.5 344 L 1295.51 344 C 1299.84 344.05 1303.95 345.86 1306.84 349 L 1327.43 372 C 1328.01 373.28 1328.01 374.72 1327.43 376 L 1306.84 399 C 1303.95 402.14 1299.84 403.95 1295.51 404 L 1260.5 404 C 1256.17 403.95 1252.06 402.14 1249.17 399 L 1228.58 376 C 1228 374.72 1228 373.28 1228.58 372 L 1249.17 349 Z" fill="#9ac7bf" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(1242,360)">
+      <switch>
+	<foreignObject pointer-events="all" width="71" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 71px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      right button<br />
+	      release<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="36" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 979.17 349 C 982.06 345.86 986.17 344.05 990.5 344 L 1025.51 344 C 1029.84 344.05 1033.95 345.86 1036.84 349 L 1057.43 372 C 1058.01 373.28 1058.01 374.72 1057.43 376 L 1036.84 399 C 1033.95 402.14 1029.84 403.95 1025.51 404 L 990.5 404 C 986.17 403.95 982.06 402.14 979.17 399 L 958.58 376 C 958 374.72 958 373.28 958.58 372 L 979.17 349 Z" fill="#ffffff" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(982,367)">
+      <switch>
+	<foreignObject pointer-events="all" width="51" height="17" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 51px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      timeout</div>
+	  </div>
+	</foreignObject>
+	<text x="26" y="15" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 869.17 249 C 872.06 245.86 876.17 244.05 880.5 244 L 915.51 244 C 919.84 244.05 923.95 245.86 926.84 249 L 947.43 272 C 948.01 273.28 948.01 274.72 947.43 276 L 926.84 299 C 923.95 302.14 919.84 303.95 915.51 304 L 880.5 304 C 876.17 303.95 872.06 302.14 869.17 299 L 848.58 276 C 848 274.72 848 273.28 848.58 272 L 869.17 249 Z" fill="#ffffff" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(860,260)">
+      <switch>
+	<foreignObject pointer-events="all" width="75" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 75px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      other button<br />
+	      press<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="38" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1018 239 L 954.12 257.25" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 949.07 258.69 L 954.84 253.4 L 954.12 257.25 L 956.77 260.14 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 827.61 449.1 C 828.78 445.9 830.67 444.04 832.67 444.12 L 902.53 444.12 C 904.13 444.08 905.65 444.63 906.65 445.61 C 907.64 446.59 907.99 447.88 907.6 449.1 L 888.36 498.9 C 887.19 502.1 885.3 503.96 883.3 503.88 L 812.42 503.88 C 811.01 503.69 809.77 503.05 808.99 502.1 C 808.22 501.15 808 499.99 808.37 498.9 Z" fill="#ea6b66" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(818,460)">
+      <switch>
+	<foreignObject pointer-events="all" width="80" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 80px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      BTN_RIGHT<br />
+	      PRESS<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="40" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 963 404 L 908.3 440.47" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 903.93 443.38 L 907.81 436.58 L 908.3 440.47 L 911.7 442.41 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 833 504 L 777.14 569.17" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 773.73 573.15 L 775.63 565.56 L 777.14 569.17 L 780.94 570.11 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1056 254 L 1022.37 338.09" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1020.42 342.96 L 1019.77 335.16 L 1022.37 338.09 L 1026.26 337.76 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1110 254 L 1230.82 340.3" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1235.09 343.35 L 1227.36 342.13 L 1230.82 340.3 L 1231.43 336.43 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1307.61 449.1 C 1308.78 445.9 1310.67 444.04 1312.67 444.12 L 1382.53 444.12 C 1384.13 444.08 1385.65 444.63 1386.65 445.61 C 1387.64 446.59 1387.99 447.88 1387.6 449.1 L 1368.36 498.9 C 1367.19 502.1 1365.3 503.96 1363.3 503.88 L 1292.42 503.88 C 1291.01 503.69 1289.77 503.05 1288.99 502.1 C 1288.22 501.15 1288 499.99 1288.37 498.9 Z" fill="#ea6b66" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(1298,460)">
+      <switch>
+	<foreignObject pointer-events="all" width="80" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 80px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      BTN_RIGHT<br />
+	      PRESS<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="40" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1377.61 539.1 C 1378.78 535.9 1380.67 534.04 1382.67 534.12 L 1452.53 534.12 C 1454.13 534.08 1455.65 534.63 1456.65 535.61 C 1457.64 536.59 1457.99 537.88 1457.6 539.1 L 1438.36 588.9 C 1437.19 592.1 1435.3 593.96 1433.3 593.88 L 1362.42 593.88 C 1361.01 593.69 1359.77 593.05 1358.99 592.1 C 1358.22 591.15 1358 589.99 1358.37 588.9 Z" fill="#ea6b66" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(1368,550)">
+      <switch>
+	<foreignObject pointer-events="all" width="80" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 80px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      BTN_RIGHT<br />
+	      RELEASE<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="40" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1296 404 L 1316.72 438.54" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1319.42 443.04 L 1312.82 438.84 L 1316.72 438.54 L 1318.82 435.24 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1362 504 L 1381.13 528.95" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1384.32 533.11 L 1377.28 529.69 L 1381.13 528.95 L 1382.84 525.43 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1458 564 L 1488 564 Q 1498 564 1498 554 L 1498 42 Q 1498 32 1488 32 L 804.37 32" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 799.12 32 L 806.12 28.5 L 804.37 32 L 806.12 35.5 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1082 254 L 1121.31 338.23" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1123.53 342.99 L 1117.4 338.12 L 1121.31 338.23 L 1123.74 335.16 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1110 404 L 830.3 709.3" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 826.76 713.18 L 828.9 705.65 L 830.3 709.3 L 834.06 710.38 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1049.17 909 C 1052.06 905.86 1056.17 904.05 1060.5 904 L 1095.51 904 C 1099.84 904.05 1103.95 905.86 1106.84 909 L 1127.43 932 C 1128.01 933.28 1128.01 934.72 1127.43 936 L 1106.84 959 C 1103.95 962.14 1099.84 963.95 1095.51 964 L 1060.5 964 C 1056.17 963.95 1052.06 962.14 1049.17 959 L 1028.58 936 C 1028 934.72 1028 933.28 1028.58 932 L 1049.17 909 Z" fill="#ffffff" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(1040,920)">
+      <switch>
+	<foreignObject pointer-events="all" width="75" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 75px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      other button<br />
+	      press<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="38" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 858 902 L 1021.7 926.07" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1026.89 926.84 L 1019.46 929.28 L 1021.7 926.07 L 1020.48 922.36 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1217.61 969.1 C 1218.78 965.9 1220.67 964.04 1222.67 964.12 L 1292.53 964.12 C 1294.13 964.08 1295.65 964.63 1296.65 965.61 C 1297.64 966.59 1297.99 967.88 1297.6 969.1 L 1278.36 1018.9 C 1277.19 1022.1 1275.3 1023.96 1273.3 1023.88 L 1202.42 1023.88 C 1201.01 1023.69 1199.77 1023.05 1198.99 1022.1 C 1198.22 1021.15 1198 1019.99 1198.37 1018.9 Z" fill="#ea6b66" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(1204,980)">
+      <switch>
+	<foreignObject pointer-events="all" width="87" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 87px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      BTN_MIDDLE<br />
+	      RELEASE<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="44" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1128 952 L 1191.98 973.93" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1196.94 975.64 L 1189.19 976.68 L 1191.98 973.93 L 1191.46 970.06 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 408 674 L 18 674 Q 8 674 8 664 L 8 42 Q 8 32 18 32 L 691.63 32" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 696.88 32 L 689.88 35.5 L 691.63 32 L 689.88 28.5 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <ellipse cx="1248" cy="1174" rx="50" ry="30" fill="#ccccff" stroke="#000000" stroke-width="2" pointer-events="none"/>
+    <g transform="translate(1208,1167)">
+      <switch>
+	<foreignObject pointer-events="all" width="80" height="17" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 80px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      IGNORE_LR</div>
+	  </div>
+	</foreignObject>
+	<text x="40" y="15" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1127.17 1384 C 1130.06 1380.86 1134.17 1379.05 1138.5 1379 L 1173.51 1379 C 1177.84 1379.05 1181.95 1380.86 1184.84 1384 L 1205.43 1407 C 1206.01 1408.28 1206.01 1409.72 1205.43 1411 L 1184.84 1434 C 1181.95 1437.14 1177.84 1438.95 1173.51 1439 L 1138.5 1439 C 1134.17 1438.95 1130.06 1437.14 1127.17 1434 L 1106.58 1411 C 1106 1409.72 1106 1408.28 1106.58 1407 L 1127.17 1384 Z" fill="#ffd966" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(1123,1395)">
+      <switch>
+	<foreignObject pointer-events="all" width="65" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 65px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      left button<br />
+	      release<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="33" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1277.17 1384 C 1280.06 1380.86 1284.17 1379.05 1288.5 1379 L 1323.51 1379 C 1327.84 1379.05 1331.95 1380.86 1334.84 1384 L 1355.43 1407 C 1356.01 1408.28 1356.01 1409.72 1355.43 1411 L 1334.84 1434 C 1331.95 1437.14 1327.84 1438.95 1323.51 1439 L 1288.5 1439 C 1284.17 1438.95 1280.06 1437.14 1277.17 1434 L 1256.58 1411 C 1256 1409.72 1256 1408.28 1256.58 1407 L 1277.17 1384 Z" fill="#9ac7bf" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(1270,1395)">
+      <switch>
+	<foreignObject pointer-events="all" width="71" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 71px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      right button<br />
+	      release<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="36" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1449.17 1249 C 1452.06 1245.86 1456.17 1244.05 1460.5 1244 L 1495.51 1244 C 1499.84 1244.05 1503.95 1245.86 1506.84 1249 L 1527.43 1272 C 1528.01 1273.28 1528.01 1274.72 1527.43 1276 L 1506.84 1299 C 1503.95 1302.14 1499.84 1303.95 1495.51 1304 L 1460.5 1304 C 1456.17 1303.95 1452.06 1302.14 1449.17 1299 L 1428.58 1276 C 1428 1274.72 1428 1273.28 1428.58 1272 L 1449.17 1249 Z" fill="#ffffff" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(1440,1260)">
+      <switch>
+	<foreignObject pointer-events="all" width="75" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 75px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      other button<br />
+	      event<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="38" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1298 1196 L 1422.15 1249.48" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1426.97 1251.56 L 1419.16 1252 L 1422.15 1249.48 L 1421.93 1245.57 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1255 1204 L 1297.45 1372.82" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1298.73 1377.92 L 1293.63 1371.98 L 1297.45 1372.82 L 1300.41 1370.27 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1236 1204 L 1170.31 1373.06" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1168.4 1377.96 L 1167.68 1370.17 L 1170.31 1373.06 L 1174.2 1372.7 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <ellipse cx="1236" cy="1959" rx="50" ry="30" fill="#ccccff" stroke="#000000" stroke-width="2" pointer-events="none"/>
+    <g transform="translate(1185,1952)">
+      <switch>
+	<foreignObject pointer-events="all" width="102" height="17" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 102px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      PASSTHROUGH</div>
+	  </div>
+	</foreignObject>
+	<text x="51" y="15" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <ellipse cx="1136" cy="1579" rx="50" ry="30" fill="#ccccff" stroke="#000000" stroke-width="2" pointer-events="none"/>
+    <g transform="translate(1099,1572)">
+      <switch>
+	<foreignObject pointer-events="all" width="73" height="17" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 73px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      IGNORE_R</div>
+	  </div>
+	</foreignObject>
+	<text x="37" y="15" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <ellipse cx="1306" cy="1579" rx="50" ry="30" fill="#ccccff" stroke="#000000" stroke-width="2" pointer-events="none"/>
+    <g transform="translate(1270,1572)">
+      <switch>
+	<foreignObject pointer-events="all" width="71" height="17" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 71px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      IGNORE_L</div>
+	  </div>
+	</foreignObject>
+	<text x="36" y="15" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1306 1439 L 1306 1542.63" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1306 1547.88 L 1302.5 1540.88 L 1306 1542.63 L 1309.5 1540.88 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1153 1439 L 1140.75 1542.68" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1140.13 1547.89 L 1137.48 1540.53 L 1140.75 1542.68 L 1144.43 1541.35 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1017.17 1744 C 1020.06 1740.86 1024.17 1739.05 1028.5 1739 L 1063.51 1739 C 1067.84 1739.05 1071.95 1740.86 1074.84 1744 L 1095.43 1767 C 1096.01 1768.28 1096.01 1769.72 1095.43 1771 L 1074.84 1794 C 1071.95 1797.14 1067.84 1798.95 1063.51 1799 L 1028.5 1799 C 1024.17 1798.95 1020.06 1797.14 1017.17 1794 L 996.58 1771 C 996 1769.72 996 1768.28 996.58 1767 L 1017.17 1744 Z" fill="#ffd966" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(1013,1755)">
+      <switch>
+	<foreignObject pointer-events="all" width="65" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 65px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      left button<br />
+	      press<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="33" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 885.61 1694.1 C 886.78 1690.9 888.67 1689.04 890.67 1689.12 L 960.53 1689.12 C 962.13 1689.08 963.65 1689.63 964.65 1690.61 C 965.64 1691.59 965.99 1692.88 965.6 1694.1 L 946.36 1743.9 C 945.19 1747.1 943.3 1748.96 941.3 1748.88 L 870.42 1748.88 C 869.01 1748.69 867.77 1748.05 866.99 1747.1 C 866.22 1746.15 866 1744.99 866.37 1743.9 Z" fill="#ea6b66" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(880,1705)">
+      <switch>
+	<foreignObject pointer-events="all" width="71" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 71px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      BTN_LEFT<br />
+	      PRESS<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="36" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 996 1750 L 971.91 1740.37" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 967.04 1738.42 L 974.84 1737.77 L 971.91 1740.37 L 972.24 1744.26 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 963 1689 L 1083.62 1612.41" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1088.06 1609.6 L 1084.02 1616.31 L 1083.62 1612.41 L 1080.27 1610.4 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1122 1609 L 1062.74 1733.25" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1060.48 1737.99 L 1060.34 1730.17 L 1062.74 1733.25 L 1066.65 1733.18 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1177.17 1664 C 1180.06 1660.86 1184.17 1659.05 1188.5 1659 L 1223.51 1659 C 1227.84 1659.05 1231.95 1660.86 1234.84 1664 L 1255.43 1687 C 1256.01 1688.28 1256.01 1689.72 1255.43 1691 L 1234.84 1714 C 1231.95 1717.14 1227.84 1718.95 1223.51 1719 L 1188.5 1719 C 1184.17 1718.95 1180.06 1717.14 1177.17 1714 L 1156.58 1691 C 1156 1689.72 1156 1688.28 1156.58 1687 L 1177.17 1664 Z" fill="#ffd966" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(1173,1675)">
+      <switch>
+	<foreignObject pointer-events="all" width="65" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 65px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      left button<br />
+	      release<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="33" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1155 1609 L 1183.57 1653.64" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1186.4 1658.06 L 1179.68 1654.05 L 1183.57 1653.64 L 1185.57 1650.28 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 885.61 1614.1 C 886.78 1610.9 888.67 1609.04 890.67 1609.12 L 960.53 1609.12 C 962.13 1609.08 963.65 1609.63 964.65 1610.61 C 965.64 1611.59 965.99 1612.88 965.6 1614.1 L 946.36 1663.9 C 945.19 1667.1 943.3 1668.96 941.3 1668.88 L 870.42 1668.88 C 869.01 1668.69 867.77 1668.05 866.99 1667.1 C 866.22 1666.15 866 1664.99 866.37 1663.9 Z" fill="#ea6b66" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(880,1625)">
+      <switch>
+	<foreignObject pointer-events="all" width="71" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 71px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      BTN_LEFT<br />
+	      RELEASE<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="36" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1156 1680 L 972.28 1649.06" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 967.1 1648.19 L 974.59 1645.9 L 972.28 1649.06 L 973.42 1652.8 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 966 1625 L 1079.85 1594.64" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1084.92 1593.29 L 1079.06 1598.47 L 1079.85 1594.64 L 1077.25 1591.71 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1127.17 1794 C 1130.06 1790.86 1134.17 1789.05 1138.5 1789 L 1173.51 1789 C 1177.84 1789.05 1181.95 1790.86 1184.84 1794 L 1205.43 1817 C 1206.01 1818.28 1206.01 1819.72 1205.43 1821 L 1184.84 1844 C 1181.95 1847.14 1177.84 1848.95 1173.51 1849 L 1138.5 1849 C 1134.17 1848.95 1130.06 1847.14 1127.17 1844 L 1106.58 1821 C 1106 1819.72 1106 1818.28 1106.58 1817 L 1127.17 1794 Z" fill="#9ac7bf" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(1120,1805)">
+      <switch>
+	<foreignObject pointer-events="all" width="71" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 71px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      right button<br />
+	      release<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="36" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1139 1609 L 1153.47 1782.65" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1153.91 1787.89 L 1149.84 1781.2 L 1153.47 1782.65 L 1156.81 1780.62 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1173 1849 L 1215.83 1923.48" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1218.44 1928.03 L 1211.92 1923.71 L 1215.83 1923.48 L 1217.99 1920.22 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1367.17 1684 C 1370.06 1680.86 1374.17 1679.05 1378.5 1679 L 1413.51 1679 C 1417.84 1679.05 1421.95 1680.86 1424.84 1684 L 1445.43 1707 C 1446.01 1708.28 1446.01 1709.72 1445.43 1711 L 1424.84 1734 C 1421.95 1737.14 1417.84 1738.95 1413.51 1739 L 1378.5 1739 C 1374.17 1738.95 1370.06 1737.14 1367.17 1734 L 1346.58 1711 C 1346 1709.72 1346 1708.28 1346.58 1707 L 1367.17 1684 Z" fill="#9ac7bf" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(1360,1695)">
+      <switch>
+	<foreignObject pointer-events="all" width="71" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 71px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      right button<br />
+	      release<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="36" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1517.17 1714 C 1520.06 1710.86 1524.17 1709.05 1528.5 1709 L 1563.51 1709 C 1567.84 1709.05 1571.95 1710.86 1574.84 1714 L 1595.43 1737 C 1596.01 1738.28 1596.01 1739.72 1595.43 1741 L 1574.84 1764 C 1571.95 1767.14 1567.84 1768.95 1563.51 1769 L 1528.5 1769 C 1524.17 1768.95 1520.06 1767.14 1517.17 1764 L 1496.58 1741 C 1496 1739.72 1496 1738.28 1496.58 1737 L 1517.17 1714 Z" fill="#9ac7bf" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(1510,1725)">
+      <switch>
+	<foreignObject pointer-events="all" width="71" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 71px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      right button<br />
+	      press<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="36" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1590.61 1624.1 C 1591.78 1620.9 1593.67 1619.04 1595.67 1619.12 L 1665.53 1619.12 C 1667.13 1619.08 1668.65 1619.63 1669.65 1620.61 C 1670.64 1621.59 1670.99 1622.88 1670.6 1624.1 L 1651.36 1673.9 C 1650.19 1677.1 1648.3 1678.96 1646.3 1678.88 L 1575.42 1678.88 C 1574.01 1678.69 1572.77 1678.05 1571.99 1677.1 C 1571.22 1676.15 1571 1674.99 1571.37 1673.9 Z" fill="#ea6b66" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(1581,1635)">
+      <switch>
+	<foreignObject pointer-events="all" width="80" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 80px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      BTN_RIGHT<br />
+	      PRESS<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="40" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1590.61 1544.1 C 1591.78 1540.9 1593.67 1539.04 1595.67 1539.12 L 1665.53 1539.12 C 1667.13 1539.08 1668.65 1539.63 1669.65 1540.61 C 1670.64 1541.59 1670.99 1542.88 1670.6 1544.1 L 1651.36 1593.9 C 1650.19 1597.1 1648.3 1598.96 1646.3 1598.88 L 1575.42 1598.88 C 1574.01 1598.69 1572.77 1598.05 1571.99 1597.1 C 1571.22 1596.15 1571 1594.99 1571.37 1593.9 Z" fill="#ea6b66" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(1581,1555)">
+      <switch>
+	<foreignObject pointer-events="all" width="80" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 80px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      BTN_RIGHT<br />
+	      RELEASE<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="40" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1444 1679 L 1567.59 1602.36" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1572.05 1599.59 L 1567.95 1606.25 L 1567.59 1602.36 L 1564.26 1600.3 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1571 1571 L 1362.37 1576.82" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1357.12 1576.97 L 1364.02 1573.27 L 1362.37 1576.82 L 1364.21 1580.27 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1327 1609 L 1371.4 1673.75" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1374.37 1678.08 L 1367.52 1674.28 L 1371.4 1673.75 L 1373.3 1670.33 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1571 1709 L 1591.92 1683.89" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1595.28 1679.86 L 1593.49 1687.48 L 1591.92 1683.89 L 1588.11 1683 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1571 1638 L 1362.21 1591.39" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1357.09 1590.24 L 1364.69 1588.35 L 1362.21 1591.39 L 1363.16 1595.18 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1351 1609 L 1495.7 1705.47" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1500.07 1708.38 L 1492.3 1707.41 L 1495.7 1705.47 L 1496.19 1701.58 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1307.17 1794 C 1310.06 1790.86 1314.17 1789.05 1318.5 1789 L 1353.51 1789 C 1357.84 1789.05 1361.95 1790.86 1364.84 1794 L 1385.43 1817 C 1386.01 1818.28 1386.01 1819.72 1385.43 1821 L 1364.84 1844 C 1361.95 1847.14 1357.84 1848.95 1353.51 1849 L 1318.5 1849 C 1314.17 1848.95 1310.06 1847.14 1307.17 1844 L 1286.58 1821 C 1286 1819.72 1286 1818.28 1286.58 1817 L 1307.17 1794 Z" fill="#ffd966" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(1303,1805)">
+      <switch>
+	<foreignObject pointer-events="all" width="65" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 65px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      left button<br />
+	      release<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="33" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1310 1609 L 1331.23 1782.68" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1331.86 1787.89 L 1327.54 1781.37 L 1331.23 1782.68 L 1334.49 1780.52 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1314 1849 L 1260.7 1923.81" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1257.65 1928.09 L 1258.86 1920.36 L 1260.7 1923.81 L 1264.56 1924.42 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 979.17 1239 C 982.06 1235.86 986.17 1234.05 990.5 1234 L 1025.51 1234 C 1029.84 1234.05 1033.95 1235.86 1036.84 1239 L 1057.43 1262 C 1058.01 1263.28 1058.01 1264.72 1057.43 1266 L 1036.84 1289 C 1033.95 1292.14 1029.84 1293.95 1025.51 1294 L 990.5 1294 C 986.17 1293.95 982.06 1292.14 979.17 1289 L 958.58 1266 C 958 1264.72 958 1263.28 958.58 1262 L 979.17 1239 Z" fill="#ffffff" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(970,1250)">
+      <switch>
+	<foreignObject pointer-events="all" width="75" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 75px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      other button<br />
+	      press<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="38" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 938 1240 L 951.99 1244.9" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 956.94 1246.63 L 949.18 1247.62 L 951.99 1244.9 L 951.49 1241.01 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 959.17 1319 C 962.06 1315.86 966.17 1314.05 970.5 1314 L 1005.51 1314 C 1009.84 1314.05 1013.95 1315.86 1016.84 1319 L 1037.43 1342 C 1038.01 1343.28 1038.01 1344.72 1037.43 1346 L 1016.84 1369 C 1013.95 1372.14 1009.84 1373.95 1005.51 1374 L 970.5 1374 C 966.17 1373.95 962.06 1372.14 959.17 1369 L 938.58 1346 C 938 1344.72 938 1343.28 938.58 1342 L 959.17 1319 Z" fill="#ffffff" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(950,1330)">
+      <switch>
+	<foreignObject pointer-events="all" width="75" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 75px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      other button<br />
+	      press<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="38" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 788 1248 L 932.26 1317.24" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 936.99 1319.52 L 929.17 1319.64 L 932.26 1317.24 L 932.2 1313.33 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1427.61 1149.1 C 1428.78 1145.9 1430.67 1144.04 1432.67 1144.12 L 1502.53 1144.12 C 1504.13 1144.08 1505.65 1144.63 1506.65 1145.61 C 1507.64 1146.59 1507.99 1147.88 1507.6 1149.1 L 1488.36 1198.9 C 1487.19 1202.1 1485.3 1203.96 1483.3 1203.88 L 1412.42 1203.88 C 1411.01 1203.69 1409.77 1203.05 1408.99 1202.1 C 1408.22 1201.15 1408 1199.99 1408.37 1198.9 Z" fill="#f8cecc" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(1437,1160)">
+      <switch>
+	<foreignObject pointer-events="all" width="41" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 41px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      BTN*<br />
+	      event<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="21" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1472 1244 L 1465.25 1210.24" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1464.22 1205.1 L 1469.02 1211.27 L 1465.25 1210.24 L 1462.16 1212.65 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1408 1174 L 1304.37 1174" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1299.12 1174 L 1306.12 1170.5 L 1304.37 1174 L 1306.12 1177.5 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1307.61 1049.1 C 1308.78 1045.9 1310.67 1044.04 1312.67 1044.12 L 1382.53 1044.12 C 1384.13 1044.08 1385.65 1044.63 1386.65 1045.61 C 1387.64 1046.59 1387.99 1047.88 1387.6 1049.1 L 1368.36 1098.9 C 1367.19 1102.1 1365.3 1103.96 1363.3 1103.88 L 1292.42 1103.88 C 1291.01 1103.69 1289.77 1103.05 1288.99 1102.1 C 1288.22 1101.15 1288 1099.99 1288.37 1098.9 Z" fill="#f8cecc" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(1317,1060)">
+      <switch>
+	<foreignObject pointer-events="all" width="41" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 41px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      BTN*<br />
+	      event<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="21" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1282 1024 L 1299.29 1039.72" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1303.17 1043.25 L 1295.64 1041.13 L 1299.29 1039.72 L 1300.35 1035.95 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1311 1104 L 1279.26 1139.27" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1275.75 1143.17 L 1277.83 1135.62 L 1279.26 1139.27 L 1283.03 1140.31 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1125.61 1249.1 C 1126.78 1245.9 1128.67 1244.04 1130.67 1244.12 L 1200.53 1244.12 C 1202.13 1244.08 1203.65 1244.63 1204.65 1245.61 C 1205.64 1246.59 1205.99 1247.88 1205.6 1249.1 L 1186.36 1298.9 C 1185.19 1302.1 1183.3 1303.96 1181.3 1303.88 L 1110.42 1303.88 C 1109.01 1303.69 1107.77 1303.05 1106.99 1302.1 C 1106.22 1301.15 1106 1299.99 1106.37 1298.9 Z" fill="#f8cecc" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(1135,1260)">
+      <switch>
+	<foreignObject pointer-events="all" width="41" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 41px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      BTN*<br />
+	      event<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="21" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1058 1268 L 1099.64 1270.6" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1104.88 1270.93 L 1097.68 1273.99 L 1099.64 1270.6 L 1098.12 1267 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1171 1304 L 1288.2 1543.28" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1290.51 1548 L 1284.29 1543.25 L 1288.2 1543.28 L 1290.57 1540.17 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1015.61 1399.1 C 1016.78 1395.9 1018.67 1394.04 1020.67 1394.12 L 1090.53 1394.12 C 1092.13 1394.08 1093.65 1394.63 1094.65 1395.61 C 1095.64 1396.59 1095.99 1397.88 1095.6 1399.1 L 1076.36 1448.9 C 1075.19 1452.1 1073.3 1453.96 1071.3 1453.88 L 1000.42 1453.88 C 999.01 1453.69 997.77 1453.05 996.99 1452.1 C 996.22 1451.15 996 1449.99 996.37 1448.9 Z" fill="#f8cecc" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(1025,1410)">
+      <switch>
+	<foreignObject pointer-events="all" width="41" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 41px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      BTN*<br />
+	      event<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="21" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1010 1374 L 1020.35 1388.78" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1023.36 1393.08 L 1016.48 1389.36 L 1020.35 1388.78 L 1022.21 1385.34 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1064 1454 L 1115.81 1543.49" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1118.44 1548.03 L 1111.9 1543.73 L 1115.81 1543.49 L 1117.96 1540.22 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 717.61 459.1 C 718.78 455.9 720.67 454.04 722.67 454.12 L 792.53 454.12 C 794.13 454.08 795.65 454.63 796.65 455.61 C 797.64 456.59 797.99 457.88 797.6 459.1 L 778.36 508.9 C 777.19 512.1 775.3 513.96 773.3 513.88 L 702.42 513.88 C 701.01 513.69 699.77 513.05 698.99 512.1 C 698.22 511.15 698 509.99 698.37 508.9 Z" fill="#f8cecc" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(727,470)">
+      <switch>
+	<foreignObject pointer-events="all" width="41" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 41px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      BTN*<br />
+	      event<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="21" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 757 294 L 749.32 447.64" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 749.06 452.88 L 745.91 445.72 L 749.32 447.64 L 752.9 446.07 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 748 514 L 748 567.63" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 748 572.88 L 744.5 565.88 L 748 567.63 L 751.5 565.88 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 643.61 369.1 C 644.78 365.9 646.67 364.04 648.67 364.12 L 718.53 364.12 C 720.13 364.08 721.65 364.63 722.65 365.61 C 723.64 366.59 723.99 367.88 723.6 369.1 L 704.36 418.9 C 703.19 422.1 701.3 423.96 699.3 423.88 L 628.42 423.88 C 627.01 423.69 625.77 423.05 624.99 422.1 C 624.22 421.15 624 419.99 624.37 418.9 Z" fill="#ea6b66" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(638,380)">
+      <switch>
+	<foreignObject pointer-events="all" width="71" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 71px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      BTN_LEFT<br />
+	      PRESS<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="36" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 625 304 L 654.93 358.42" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 657.46 363.02 L 651.02 358.57 L 654.93 358.42 L 657.15 355.2 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 699 424 L 719.02 449.03" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 722.3 453.13 L 715.2 449.85 L 719.02 449.03 L 720.66 445.47 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 807.61 349.1 C 808.78 345.9 810.67 344.04 812.67 344.12 L 882.53 344.12 C 884.13 344.08 885.65 344.63 886.65 345.61 C 887.64 346.59 887.99 347.88 887.6 349.1 L 868.36 398.9 C 867.19 402.1 865.3 403.96 863.3 403.88 L 792.42 403.88 C 791.01 403.69 789.77 403.05 788.99 402.1 C 788.22 401.15 788 399.99 788.37 398.9 Z" fill="#ea6b66" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(798,360)">
+      <switch>
+	<foreignObject pointer-events="all" width="80" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 80px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      BTN_RIGHT<br />
+	      PRESS<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="40" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 880 304 L 859.28 338.54" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 856.58 343.04 L 857.18 335.24 L 859.28 338.54 L 863.18 338.84 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 814 404 L 777.04 449.08" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 773.71 453.14 L 775.44 445.5 L 777.04 449.08 L 780.85 449.94 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 579.17 696 C 582.06 692.86 586.17 691.05 590.5 691 L 625.51 691 C 629.84 691.05 633.95 692.86 636.84 696 L 657.43 719 C 658.01 720.28 658.01 721.72 657.43 723 L 636.84 746 C 633.95 749.14 629.84 750.95 625.51 751 L 590.5 751 C 586.17 750.95 582.06 749.14 579.17 746 L 558.58 723 C 558 721.72 558 720.28 558.58 719 L 579.17 696 Z" fill="#ffffff" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(574,707)">
+      <switch>
+	<foreignObject pointer-events="all" width="67" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 67px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      any button<br />
+	      event<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="34" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 437.61 779.1 C 438.78 775.9 440.67 774.04 442.67 774.12 L 512.53 774.12 C 514.13 774.08 515.65 774.63 516.65 775.61 C 517.64 776.59 517.99 777.88 517.6 779.1 L 498.36 828.9 C 497.19 832.1 495.3 833.96 493.3 833.88 L 422.42 833.88 C 421.01 833.69 419.77 833.05 418.99 832.1 C 418.22 831.15 418 829.99 418.37 828.9 Z" fill="#f8cecc" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(447,790)">
+      <switch>
+	<foreignObject pointer-events="all" width="41" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 41px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      BTN*<br />
+	      event<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="21" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 712 634 L 648.88 686.91" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 644.86 690.28 L 647.97 683.1 L 648.88 686.91 L 652.47 688.47 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 558 750 L 523.46 770.72" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 518.96 773.42 L 523.16 766.82 L 523.46 770.72 L 526.76 772.82 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 458 624 L 508 674 L 458 724 L 408 674 Z" fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(425,660)">
+      <switch>
+	<foreignObject pointer-events="all" width="66" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 66px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      all buttons<br />
+	      up?<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="33" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 466 774 L 462.51 730.35" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 462.09 725.11 L 466.14 731.81 L 462.51 730.35 L 459.16 732.37 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 508 662 L 691.81 617.5" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 696.91 616.26 L 690.93 621.31 L 691.81 617.5 L 689.29 614.51 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <rect x="593" y="637" width="30" height="20" fill="none" stroke="none" pointer-events="none"/>
+    <g transform="translate(595,640)">
+      <switch>
+	<foreignObject pointer-events="all" width="15" height="17" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; white-space: nowrap;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      no</div>
+	  </div>
+	</foreignObject>
+	<text x="8" y="15" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <rect x="245" y="671" width="30" height="20" fill="none" stroke="none" pointer-events="none"/>
+    <g transform="translate(247,674)">
+      <switch>
+	<foreignObject pointer-events="all" width="21" height="17" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; white-space: nowrap;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      yes</div>
+	  </div>
+	</foreignObject>
+	<text x="11" y="15" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1592.17 1459 C 1595.06 1455.86 1599.17 1454.05 1603.5 1454 L 1638.51 1454 C 1642.84 1454.05 1646.95 1455.86 1649.84 1459 L 1670.43 1482 C 1671.01 1483.28 1671.01 1484.72 1670.43 1486 L 1649.84 1509 C 1646.95 1512.14 1642.84 1513.95 1638.51 1514 L 1603.5 1514 C 1599.17 1513.95 1595.06 1512.14 1592.17 1509 L 1571.58 1486 C 1571 1484.72 1571 1483.28 1571.58 1482 L 1592.17 1459 Z" fill="#ffffff" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(1583,1470)">
+      <switch>
+	<foreignObject pointer-events="all" width="75" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 75px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      other button<br />
+	      event<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="38" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1557.61 1369.1 C 1558.78 1365.9 1560.67 1364.04 1562.67 1364.12 L 1632.53 1364.12 C 1634.13 1364.08 1635.65 1364.63 1636.65 1365.61 C 1637.64 1366.59 1637.99 1367.88 1637.6 1369.1 L 1618.36 1418.9 C 1617.19 1422.1 1615.3 1423.96 1613.3 1423.88 L 1542.42 1423.88 C 1541.01 1423.69 1539.77 1423.05 1538.99 1422.1 C 1538.22 1421.15 1538 1419.99 1538.37 1418.9 Z" fill="#f8cecc" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(1567,1380)">
+      <switch>
+	<foreignObject pointer-events="all" width="41" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 41px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      BTN*<br />
+	      event<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="21" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1356 1564 L 1564.9 1500.84" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1569.93 1499.32 L 1564.24 1504.7 L 1564.9 1500.84 L 1562.22 1498 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1605 1454 L 1591.14 1429.54" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1588.55 1424.97 L 1595.05 1429.34 L 1591.14 1429.54 L 1588.96 1432.79 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1542 1424 L 1357.32 1545.5" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1352.93 1548.39 L 1356.86 1541.61 L 1357.32 1545.5 L 1360.71 1547.46 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 899.17 1539 C 902.06 1535.86 906.17 1534.05 910.5 1534 L 945.51 1534 C 949.84 1534.05 953.95 1535.86 956.84 1539 L 977.43 1562 C 978.01 1563.28 978.01 1564.72 977.43 1566 L 956.84 1589 C 953.95 1592.14 949.84 1593.95 945.51 1594 L 910.5 1594 C 906.17 1593.95 902.06 1592.14 899.17 1589 L 878.58 1566 C 878 1564.72 878 1563.28 878.58 1562 L 899.17 1539 Z" fill="#ffffff" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(890,1550)">
+      <switch>
+	<foreignObject pointer-events="all" width="75" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 75px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      other button<br />
+	      event<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="38" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 917.61 1459.1 C 918.78 1455.9 920.67 1454.04 922.67 1454.12 L 992.53 1454.12 C 994.13 1454.08 995.65 1454.63 996.65 1455.61 C 997.64 1456.59 997.99 1457.88 997.6 1459.1 L 978.36 1508.9 C 977.19 1512.1 975.3 1513.96 973.3 1513.88 L 902.42 1513.88 C 901.01 1513.69 899.77 1513.05 898.99 1512.1 C 898.22 1511.15 898 1509.99 898.37 1508.9 Z" fill="#f8cecc" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(927,1470)">
+      <switch>
+	<foreignObject pointer-events="all" width="41" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 41px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      BTN*<br />
+	      event<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="21" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1086 1576 L 984.35 1568.47" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 979.11 1568.08 L 986.35 1565.11 L 984.35 1568.47 L 985.84 1572.09 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 936 1534 L 939.46 1520.18" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 940.73 1515.08 L 942.43 1522.72 L 939.46 1520.18 L 935.64 1521.03 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 998 1509 L 1080.33 1551.1" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1085 1553.49 L 1077.18 1553.42 L 1080.33 1551.1 L 1080.37 1547.19 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1068.17 1995 C 1071.06 1991.86 1075.17 1990.05 1079.5 1990 L 1114.51 1990 C 1118.84 1990.05 1122.95 1991.86 1125.84 1995 L 1146.43 2018 C 1147.01 2019.28 1147.01 2020.72 1146.43 2022 L 1125.84 2045 C 1122.95 2048.14 1118.84 2049.95 1114.51 2050 L 1079.5 2050 C 1075.17 2049.95 1071.06 2048.14 1068.17 2045 L 1047.58 2022 C 1047 2020.72 1047 2019.28 1047.58 2018 L 1068.17 1995 Z" fill="#ffffff" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(1063,2006)">
+      <switch>
+	<foreignObject pointer-events="all" width="67" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 67px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      any button<br />
+	      event<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="34" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 899.61 2094.1 C 900.78 2090.9 902.67 2089.04 904.67 2089.12 L 974.53 2089.12 C 976.13 2089.08 977.65 2089.63 978.65 2090.61 C 979.64 2091.59 979.99 2092.88 979.6 2094.1 L 960.36 2143.9 C 959.19 2147.1 957.3 2148.96 955.3 2148.88 L 884.42 2148.88 C 883.01 2148.69 881.77 2148.05 880.99 2147.1 C 880.22 2146.15 880 2144.99 880.37 2143.9 Z" fill="#f8cecc" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(909,2105)">
+      <switch>
+	<foreignObject pointer-events="all" width="41" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 41px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      BTN*<br />
+	      event<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="21" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 1186 1981 L 1152.84 1995.46" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1148.02 1997.55 L 1153.04 1991.55 L 1152.84 1995.46 L 1155.84 1997.96 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1047 2049 L 985.47 2085.74" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 980.96 2088.43 L 985.18 2081.83 L 985.47 2085.74 L 988.76 2087.84 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 930 1944 L 980 1994 L 930 2044 L 880 1994 Z" fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(897,1980)">
+      <switch>
+	<foreignObject pointer-events="all" width="66" height="32" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 66px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      all buttons<br />
+	      up?<br />
+	    </div>
+	  </div>
+	</foreignObject>
+	<text x="33" y="22" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 930 2089 L 930 2050.37" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 930 2045.12 L 933.5 2052.12 L 930 2050.37 L 926.5 2052.12 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 980 1988 L 1179.67 1965.71" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 1184.89 1965.12 L 1178.32 1969.38 L 1179.67 1965.71 L 1177.54 1962.42 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <rect x="1067" y="1929" width="30" height="20" fill="none" stroke="none" pointer-events="none"/>
+    <g transform="translate(1069,1932)">
+      <switch>
+	<foreignObject pointer-events="all" width="15" height="17" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; white-space: nowrap;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      no</div>
+	  </div>
+	</foreignObject>
+	<text x="8" y="15" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <ellipse cx="738" cy="1989" rx="50" ry="30" fill="#ccccff" stroke="#000000" stroke-width="2" pointer-events="none"/>
+    <g transform="translate(719,1982)">
+      <switch>
+	<foreignObject pointer-events="all" width="38" height="17" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; width: 38px; white-space: normal; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;" xmlns="http://www.w3.org/1999/xhtml">
+	      IDLE</div>
+	  </div>
+	</foreignObject>
+	<text x="19" y="15" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+    <path d="M 880 1993 L 794.36 1990.21" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <path d="M 789.12 1990.04 L 796.23 1986.77 L 794.36 1990.21 L 796 1993.76 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="none"/>
+    <g transform="translate(827,1997)">
+      <switch>
+	<foreignObject pointer-events="all" width="21" height="17" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+	  <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.26; vertical-align: top; white-space: nowrap; text-align: center;">
+	    <div style="display:inline-block;text-align:inherit;text-decoration:inherit;background-color:#ffffff;" xmlns="http://www.w3.org/1999/xhtml">
+	      yes</div>
+	  </div>
+	</foreignObject>
+	<text x="11" y="15" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">
+	  [Not supported by viewer]</text>
+      </switch>
+    </g>
+  </g>
+</svg>
diff --git a/src/Makefile.am b/src/Makefile.am
index 0f180cc..90bdc9a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -11,6 +11,7 @@ libinput_la_SOURCES =			\
 	libinput-private.h		\
 	evdev.c				\
 	evdev.h				\
+	evdev-middle-button.c		\
 	evdev-mt-touchpad.c		\
 	evdev-mt-touchpad.h		\
 	evdev-mt-touchpad-tap.c		\
diff --git a/src/evdev-middle-button.c b/src/evdev-middle-button.c
new file mode 100644
index 0000000..15d0688
--- /dev/null
+++ b/src/evdev-middle-button.c
@@ -0,0 +1,673 @@
+/*
+ * Copyright © 2014 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of the copyright holders not be used in
+ * advertising or publicity pertaining to distribution of the software
+ * without specific, written prior permission.  The copyright holders make
+ * no representations about the suitability of this software for any
+ * purpose.  It is provided "as is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <stdint.h>
+
+#include "evdev.h"
+
+#define MIDDLEBUTTON_TIMEOUT 50
+
+/*****************************************
+ * BEFORE YOU EDIT THIS FILE, look at the state diagram in
+ * doc/middle-button-emulation-state-machine.svg, or online at
+ * https://drive.google.com/file/d/0B1NwWmji69nodUJncXRMc1FvY1k/view?usp=sharing
+ * (it's a http://draw.io diagram)
+ *
+ * Any changes in this file must be represented in the diagram.
+ *
+ * Note in regards to the state machine: it only handles left, right and
+ * emulated middle button clicks, all other button events are passed
+ * through. When in the PASSTHROUGH state, all events are passed through
+ * as-is.
+ */
+
+#define CASE_RETURN_STRING(a) case a: return #a;
+
+static inline const char*
+middlebutton_state_to_str(enum evdev_middlebutton_state state)
+{
+	switch (state) {
+	CASE_RETURN_STRING(MIDDLEBUTTON_IDLE);
+	CASE_RETURN_STRING(MIDDLEBUTTON_LEFT_DOWN);
+	CASE_RETURN_STRING(MIDDLEBUTTON_RIGHT_DOWN);
+	CASE_RETURN_STRING(MIDDLEBUTTON_MIDDLE);
+	CASE_RETURN_STRING(MIDDLEBUTTON_LEFT_UP_PENDING);
+	CASE_RETURN_STRING(MIDDLEBUTTON_RIGHT_UP_PENDING);
+	CASE_RETURN_STRING(MIDDLEBUTTON_PASSTHROUGH);
+	CASE_RETURN_STRING(MIDDLEBUTTON_IGNORE_LR);
+	CASE_RETURN_STRING(MIDDLEBUTTON_IGNORE_L);
+	CASE_RETURN_STRING(MIDDLEBUTTON_IGNORE_R);
+	}
+
+	return NULL;
+}
+
+static inline const char*
+middlebutton_event_to_str(enum evdev_middlebutton_event event)
+{
+	switch (event) {
+	CASE_RETURN_STRING(MIDDLEBUTTON_EVENT_L_DOWN);
+	CASE_RETURN_STRING(MIDDLEBUTTON_EVENT_R_DOWN);
+	CASE_RETURN_STRING(MIDDLEBUTTON_EVENT_OTHER);
+	CASE_RETURN_STRING(MIDDLEBUTTON_EVENT_L_UP);
+	CASE_RETURN_STRING(MIDDLEBUTTON_EVENT_R_UP);
+	CASE_RETURN_STRING(MIDDLEBUTTON_EVENT_TIMEOUT);
+	CASE_RETURN_STRING(MIDDLEBUTTON_EVENT_ALL_UP);
+	}
+
+	return NULL;
+}
+
+static void
+middlebutton_state_error(struct evdev_device *device,
+			 enum evdev_middlebutton_event event)
+{
+	log_bug_libinput(device->base.seat->libinput,
+			 "Invalid event %s in middle btn state %s\n",
+			 middlebutton_event_to_str(event),
+			 middlebutton_state_to_str(device->middlebutton.state));
+}
+
+static void
+middlebutton_timer_set(struct evdev_device *device, uint64_t now)
+{
+	libinput_timer_set(&device->middlebutton.timer,
+			   now + MIDDLEBUTTON_TIMEOUT);
+}
+
+static void
+middlebutton_post_event(struct evdev_device *device,
+			uint64_t now,
+			int button,
+			enum libinput_button_state state)
+{
+	evdev_pointer_notify_button(device,
+				    now,
+				    button,
+				    state);
+}
+
+static int
+evdev_middlebutton_idle_handle_event(struct evdev_device *device,
+				     uint64_t time,
+				     enum evdev_middlebutton_event event)
+{
+	switch (event) {
+	case MIDDLEBUTTON_EVENT_L_DOWN:
+		middlebutton_timer_set(device, time);
+		device->middlebutton.state = MIDDLEBUTTON_LEFT_DOWN;
+		device->middlebutton.first_event_time = time;
+		break;
+	case MIDDLEBUTTON_EVENT_R_DOWN:
+		middlebutton_timer_set(device, time);
+		device->middlebutton.state = MIDDLEBUTTON_RIGHT_DOWN;
+		device->middlebutton.first_event_time = time;
+		break;
+	case MIDDLEBUTTON_EVENT_OTHER:
+		return 0;
+	case MIDDLEBUTTON_EVENT_R_UP:
+	case MIDDLEBUTTON_EVENT_L_UP:
+	case MIDDLEBUTTON_EVENT_TIMEOUT:
+		middlebutton_state_error(device, event);
+		break;
+	case MIDDLEBUTTON_EVENT_ALL_UP:
+		break;
+	}
+
+	return 1;
+}
+
+static int
+evdev_middlebutton_ldown_handle_event(struct evdev_device *device,
+				      uint64_t time,
+				      enum evdev_middlebutton_event event)
+{
+	switch (event) {
+	case MIDDLEBUTTON_EVENT_L_DOWN:
+		middlebutton_state_error(device, event);
+		break;
+	case MIDDLEBUTTON_EVENT_R_DOWN:
+		middlebutton_post_event(device, time,
+					BTN_MIDDLE,
+					LIBINPUT_BUTTON_STATE_PRESSED);
+		device->middlebutton.state = MIDDLEBUTTON_MIDDLE;
+		break;
+	case MIDDLEBUTTON_EVENT_OTHER:
+		middlebutton_post_event(device, time,
+					BTN_LEFT,
+					LIBINPUT_BUTTON_STATE_PRESSED);
+		device->middlebutton.state = MIDDLEBUTTON_PASSTHROUGH;
+		return 0;
+	case MIDDLEBUTTON_EVENT_R_UP:
+		break;
+	case MIDDLEBUTTON_EVENT_L_UP:
+		middlebutton_post_event(device,
+					device->middlebutton.first_event_time,
+					BTN_LEFT,
+					LIBINPUT_BUTTON_STATE_PRESSED);
+		middlebutton_post_event(device, time,
+					BTN_LEFT,
+					LIBINPUT_BUTTON_STATE_RELEASED);
+		device->middlebutton.state = MIDDLEBUTTON_IDLE;
+		break;
+	case MIDDLEBUTTON_EVENT_TIMEOUT:
+		middlebutton_post_event(device,
+					device->middlebutton.first_event_time,
+					BTN_LEFT,
+					LIBINPUT_BUTTON_STATE_PRESSED);
+		device->middlebutton.state = MIDDLEBUTTON_PASSTHROUGH;
+		break;
+	case MIDDLEBUTTON_EVENT_ALL_UP:
+		middlebutton_state_error(device, event);
+		break;
+	}
+
+	return 1;
+}
+
+static int
+evdev_middlebutton_rdown_handle_event(struct evdev_device *device,
+				      uint64_t time,
+				      enum evdev_middlebutton_event event)
+{
+	switch (event) {
+	case MIDDLEBUTTON_EVENT_L_DOWN:
+		middlebutton_post_event(device, time,
+					BTN_MIDDLE,
+					LIBINPUT_BUTTON_STATE_PRESSED);
+		device->middlebutton.state = MIDDLEBUTTON_MIDDLE;
+		break;
+	case MIDDLEBUTTON_EVENT_R_DOWN:
+		middlebutton_state_error(device, event);
+		break;
+	case MIDDLEBUTTON_EVENT_OTHER:
+		middlebutton_post_event(device,
+					device->middlebutton.first_event_time,
+					BTN_RIGHT,
+					LIBINPUT_BUTTON_STATE_PRESSED);
+		device->middlebutton.state = MIDDLEBUTTON_PASSTHROUGH;
+		return 0;
+	case MIDDLEBUTTON_EVENT_R_UP:
+		middlebutton_post_event(device,
+					device->middlebutton.first_event_time,
+					BTN_RIGHT,
+					LIBINPUT_BUTTON_STATE_PRESSED);
+		middlebutton_post_event(device, time,
+					BTN_RIGHT,
+					LIBINPUT_BUTTON_STATE_RELEASED);
+		device->middlebutton.state = MIDDLEBUTTON_IDLE;
+		break;
+	case MIDDLEBUTTON_EVENT_L_UP:
+		middlebutton_state_error(device, event);
+		break;
+	case MIDDLEBUTTON_EVENT_TIMEOUT:
+		middlebutton_post_event(device,
+					device->middlebutton.first_event_time,
+					BTN_RIGHT,
+					LIBINPUT_BUTTON_STATE_PRESSED);
+		device->middlebutton.state = MIDDLEBUTTON_PASSTHROUGH;
+		break;
+	case MIDDLEBUTTON_EVENT_ALL_UP:
+		middlebutton_state_error(device, event);
+		break;
+	}
+
+	return 1;
+}
+
+static int
+evdev_middlebutton_middle_handle_event(struct evdev_device *device,
+				       uint64_t time,
+				       enum evdev_middlebutton_event event)
+{
+	switch (event) {
+	case MIDDLEBUTTON_EVENT_L_DOWN:
+	case MIDDLEBUTTON_EVENT_R_DOWN:
+		middlebutton_state_error(device, event);
+		break;
+	case MIDDLEBUTTON_EVENT_OTHER:
+		middlebutton_post_event(device, time,
+					BTN_MIDDLE,
+					LIBINPUT_BUTTON_STATE_RELEASED);
+		device->middlebutton.state = MIDDLEBUTTON_IGNORE_LR;
+		return 0;
+	case MIDDLEBUTTON_EVENT_R_UP:
+		middlebutton_post_event(device, time,
+					BTN_MIDDLE,
+					LIBINPUT_BUTTON_STATE_RELEASED);
+		device->middlebutton.state = MIDDLEBUTTON_LEFT_UP_PENDING;
+		break;
+	case MIDDLEBUTTON_EVENT_L_UP:
+		middlebutton_post_event(device, time,
+					BTN_MIDDLE,
+					LIBINPUT_BUTTON_STATE_RELEASED);
+		device->middlebutton.state = MIDDLEBUTTON_RIGHT_UP_PENDING;
+		break;
+	case MIDDLEBUTTON_EVENT_TIMEOUT:
+		middlebutton_state_error(device, event);
+		break;
+	case MIDDLEBUTTON_EVENT_ALL_UP:
+		middlebutton_state_error(device, event);
+		break;
+	}
+
+	return 1;
+}
+
+static int
+evdev_middlebutton_lup_pending_handle_event(struct evdev_device *device,
+					    uint64_t time,
+					    enum evdev_middlebutton_event event)
+{
+	switch (event) {
+	case MIDDLEBUTTON_EVENT_L_DOWN:
+		middlebutton_state_error(device, event);
+		break;
+	case MIDDLEBUTTON_EVENT_R_DOWN:
+		middlebutton_post_event(device, time,
+					BTN_MIDDLE,
+					LIBINPUT_BUTTON_STATE_PRESSED);
+		device->middlebutton.state = MIDDLEBUTTON_MIDDLE;
+		break;
+	case MIDDLEBUTTON_EVENT_OTHER:
+		device->middlebutton.state = MIDDLEBUTTON_IGNORE_L;
+		return 0;
+	case MIDDLEBUTTON_EVENT_R_UP:
+		middlebutton_state_error(device, event);
+		break;
+	case MIDDLEBUTTON_EVENT_L_UP:
+		device->middlebutton.state = MIDDLEBUTTON_IDLE;
+		break;
+	case MIDDLEBUTTON_EVENT_TIMEOUT:
+		middlebutton_state_error(device, event);
+		break;
+	case MIDDLEBUTTON_EVENT_ALL_UP:
+		middlebutton_state_error(device, event);
+		break;
+	}
+
+	return 1;
+}
+
+static int
+evdev_middlebutton_rup_pending_handle_event(struct evdev_device *device,
+					    uint64_t time,
+					    enum evdev_middlebutton_event event)
+{
+	switch (event) {
+	case MIDDLEBUTTON_EVENT_L_DOWN:
+		middlebutton_post_event(device, time,
+					BTN_MIDDLE,
+					LIBINPUT_BUTTON_STATE_PRESSED);
+		device->middlebutton.state = MIDDLEBUTTON_MIDDLE;
+		break;
+	case MIDDLEBUTTON_EVENT_R_DOWN:
+		middlebutton_state_error(device, event);
+		break;
+	case MIDDLEBUTTON_EVENT_OTHER:
+		device->middlebutton.state = MIDDLEBUTTON_IGNORE_R;
+		return 0;
+	case MIDDLEBUTTON_EVENT_R_UP:
+		device->middlebutton.state = MIDDLEBUTTON_IDLE;
+		break;
+	case MIDDLEBUTTON_EVENT_L_UP:
+		middlebutton_state_error(device, event);
+		break;
+	case MIDDLEBUTTON_EVENT_TIMEOUT:
+		middlebutton_state_error(device, event);
+		break;
+	case MIDDLEBUTTON_EVENT_ALL_UP:
+		middlebutton_state_error(device, event);
+		break;
+	}
+
+	return 1;
+}
+
+static int
+evdev_middlebutton_passthrough_handle_event(struct evdev_device *device,
+					    uint64_t time,
+					    enum evdev_middlebutton_event event)
+{
+	switch (event) {
+	case MIDDLEBUTTON_EVENT_L_DOWN:
+	case MIDDLEBUTTON_EVENT_R_DOWN:
+	case MIDDLEBUTTON_EVENT_OTHER:
+	case MIDDLEBUTTON_EVENT_R_UP:
+	case MIDDLEBUTTON_EVENT_L_UP:
+		return 0;
+	case MIDDLEBUTTON_EVENT_TIMEOUT:
+		middlebutton_state_error(device, event);
+		break;
+	case MIDDLEBUTTON_EVENT_ALL_UP:
+		device->middlebutton.state = MIDDLEBUTTON_IDLE;
+		break;
+	}
+
+	return 1;
+}
+
+static int
+evdev_middlebutton_ignore_lr_handle_event(struct evdev_device *device,
+					  uint64_t time,
+					  enum evdev_middlebutton_event event)
+{
+	switch (event) {
+	case MIDDLEBUTTON_EVENT_L_DOWN:
+	case MIDDLEBUTTON_EVENT_R_DOWN:
+		middlebutton_state_error(device, event);
+		break;
+	case MIDDLEBUTTON_EVENT_OTHER:
+		return 0;
+	case MIDDLEBUTTON_EVENT_R_UP:
+		device->middlebutton.state = MIDDLEBUTTON_IGNORE_L;
+		break;
+	case MIDDLEBUTTON_EVENT_L_UP:
+		device->middlebutton.state = MIDDLEBUTTON_IGNORE_R;
+		break;
+	case MIDDLEBUTTON_EVENT_TIMEOUT:
+		middlebutton_state_error(device, event);
+		break;
+	case MIDDLEBUTTON_EVENT_ALL_UP:
+		middlebutton_state_error(device, event);
+		break;
+	}
+
+	return 1;
+}
+
+static int
+evdev_middlebutton_ignore_l_handle_event(struct evdev_device *device,
+					 uint64_t time,
+					 enum evdev_middlebutton_event event)
+{
+	switch (event) {
+	case MIDDLEBUTTON_EVENT_L_DOWN:
+		middlebutton_state_error(device, event);
+		break;
+	case MIDDLEBUTTON_EVENT_R_DOWN:
+		return 0;
+	case MIDDLEBUTTON_EVENT_OTHER:
+	case MIDDLEBUTTON_EVENT_R_UP:
+		return 0;
+	case MIDDLEBUTTON_EVENT_L_UP:
+		device->middlebutton.state = MIDDLEBUTTON_PASSTHROUGH;
+		break;
+	case MIDDLEBUTTON_EVENT_TIMEOUT:
+	case MIDDLEBUTTON_EVENT_ALL_UP:
+		middlebutton_state_error(device, event);
+		break;
+	}
+
+	return 1;
+}
+static int
+evdev_middlebutton_ignore_r_handle_event(struct evdev_device *device,
+					 uint64_t time,
+					 enum evdev_middlebutton_event event)
+{
+	switch (event) {
+	case MIDDLEBUTTON_EVENT_L_DOWN:
+		return 0;
+	case MIDDLEBUTTON_EVENT_R_DOWN:
+		middlebutton_state_error(device, event);
+		break;
+	case MIDDLEBUTTON_EVENT_OTHER:
+		return 0;
+	case MIDDLEBUTTON_EVENT_R_UP:
+		device->middlebutton.state = MIDDLEBUTTON_PASSTHROUGH;
+		break;
+	case MIDDLEBUTTON_EVENT_L_UP:
+		return 0;
+	case MIDDLEBUTTON_EVENT_TIMEOUT:
+	case MIDDLEBUTTON_EVENT_ALL_UP:
+		break;
+	}
+
+	return 1;
+}
+
+static int
+evdev_middlebutton_handle_event(struct evdev_device *device,
+				uint64_t time,
+				enum evdev_middlebutton_event event)
+{
+	int rc;
+	enum evdev_middlebutton_state current;
+
+	current = device->middlebutton.state;
+
+	libinput_timer_cancel(&device->middlebutton.timer);
+
+	switch (current) {
+	case MIDDLEBUTTON_IDLE:
+		rc = evdev_middlebutton_idle_handle_event(device, time, event);
+		break;
+	case MIDDLEBUTTON_LEFT_DOWN:
+		rc = evdev_middlebutton_ldown_handle_event(device, time, event);
+		break;
+	case MIDDLEBUTTON_RIGHT_DOWN:
+		rc = evdev_middlebutton_rdown_handle_event(device, time, event);
+		break;
+	case MIDDLEBUTTON_MIDDLE:
+		rc = evdev_middlebutton_middle_handle_event(device, time, event);
+		break;
+	case MIDDLEBUTTON_LEFT_UP_PENDING:
+		rc = evdev_middlebutton_lup_pending_handle_event(device,
+								 time,
+								 event);
+		break;
+	case MIDDLEBUTTON_RIGHT_UP_PENDING:
+		rc = evdev_middlebutton_rup_pending_handle_event(device,
+								 time,
+								 event);
+		break;
+	case MIDDLEBUTTON_PASSTHROUGH:
+		rc = evdev_middlebutton_passthrough_handle_event(device,
+								 time,
+								 event);
+		break;
+	case MIDDLEBUTTON_IGNORE_LR:
+		rc = evdev_middlebutton_ignore_lr_handle_event(device,
+							       time,
+							       event);
+		break;
+	case MIDDLEBUTTON_IGNORE_L:
+		rc = evdev_middlebutton_ignore_l_handle_event(device,
+							      time,
+							      event);
+		break;
+	case MIDDLEBUTTON_IGNORE_R:
+		rc = evdev_middlebutton_ignore_r_handle_event(device,
+							      time,
+							      event);
+		break;
+	}
+
+	log_debug(device->base.seat->libinput,
+		  "middlebuttonstate: %s → %s → %s, rc %d\n",
+		  middlebutton_state_to_str(current),
+		  middlebutton_event_to_str(event),
+		  middlebutton_state_to_str(device->middlebutton.state),
+		  rc);
+
+	return rc;
+}
+
+static inline void
+evdev_middlebutton_apply_config(struct evdev_device *device)
+{
+	if (device->middlebutton.want_enabled ==
+	    device->middlebutton.enabled)
+		return;
+
+	if (device->middlebutton.button_mask != 0)
+		return;
+
+	device->middlebutton.enabled = device->middlebutton.want_enabled;
+}
+
+bool
+evdev_middlebutton_filter_button(struct evdev_device *device,
+				 uint64_t time,
+				 int button,
+				 enum libinput_button_state state)
+{
+	enum evdev_middlebutton_event event;
+	bool is_press = state == LIBINPUT_BUTTON_STATE_PRESSED;
+	int rc;
+	unsigned int bit = (button - BTN_LEFT);
+	uint32_t old_mask = 0;
+
+	if (!device->middlebutton.enabled)
+		return false;
+
+	switch (button) {
+	case BTN_LEFT:
+		if (is_press)
+			event = MIDDLEBUTTON_EVENT_L_DOWN;
+		else
+			event = MIDDLEBUTTON_EVENT_L_UP;
+		break;
+	case BTN_RIGHT:
+		if (is_press)
+			event = MIDDLEBUTTON_EVENT_R_DOWN;
+		else
+			event = MIDDLEBUTTON_EVENT_R_UP;
+		break;
+
+	/* BTN_MIDDLE counts as "other" and resets middle button
+	 * emulation */
+	case BTN_MIDDLE:
+	default:
+		event = MIDDLEBUTTON_EVENT_OTHER;
+		break;
+	}
+
+	if (button < BTN_LEFT ||
+	    bit >= sizeof(device->middlebutton.button_mask) * 8) {
+		log_bug_libinput(device->base.seat->libinput,
+				 "Button mask too small for %d\n",
+				 libevdev_event_code_get_name(EV_KEY,
+							      button));
+		return true;
+	}
+
+	rc = evdev_middlebutton_handle_event(device, time, event);
+
+	old_mask = device->middlebutton.button_mask;
+	if (is_press)
+		device->middlebutton.button_mask |= 1 << bit;
+	else
+		device->middlebutton.button_mask &= ~(1 << bit);
+
+	if (old_mask != device->middlebutton.button_mask &&
+	    device->middlebutton.button_mask == 0) {
+		evdev_middlebutton_handle_event(device,
+						time,
+						MIDDLEBUTTON_EVENT_ALL_UP);
+		evdev_middlebutton_apply_config(device);
+	}
+
+	return rc;
+}
+
+static void
+evdev_middlebutton_handle_timeout(uint64_t now, void *data)
+{
+	struct evdev_device *device = (struct evdev_device*)data;
+
+	evdev_middlebutton_handle_event(device,
+					libinput_now(device->base.seat->libinput),
+					MIDDLEBUTTON_EVENT_TIMEOUT);
+}
+
+static int
+evdev_middlebutton_is_available(struct libinput_device *device)
+{
+	return 1;
+}
+
+static enum libinput_config_status
+evdev_middlebutton_set(struct libinput_device *device,
+		       enum libinput_config_middle_emulation_state enable)
+{
+	struct evdev_device *evdev = (struct evdev_device*)device;
+
+	switch (enable) {
+	case LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED:
+		evdev->middlebutton.want_enabled = true;
+		break;
+	case LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED:
+		evdev->middlebutton.want_enabled = false;
+		break;
+	default:
+		return LIBINPUT_CONFIG_STATUS_INVALID;
+	}
+
+	evdev_middlebutton_apply_config(evdev);
+
+	return LIBINPUT_CONFIG_STATUS_SUCCESS;
+}
+
+static enum libinput_config_middle_emulation_state
+evdev_middlebutton_get(struct libinput_device *device)
+{
+	struct evdev_device *evdev = (struct evdev_device*)device;
+
+	return evdev->middlebutton.enabled ?
+			LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED :
+			LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED;
+}
+
+static enum libinput_config_middle_emulation_state
+evdev_middlebutton_get_default(struct libinput_device *device)
+{
+	struct evdev_device *evdev = (struct evdev_device*)device;
+
+	return evdev->middlebutton.enabled_default ?
+			LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED :
+			LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED;
+}
+
+void
+evdev_init_middlebutton(struct evdev_device *device,
+			bool enable,
+			bool want_config)
+{
+	libinput_timer_init(&device->middlebutton.timer,
+			    device->base.seat->libinput,
+			    evdev_middlebutton_handle_timeout,
+			    device);
+	device->middlebutton.enabled_default = enable;
+	device->middlebutton.want_enabled = enable;
+	device->middlebutton.enabled = enable;
+
+	if (!want_config)
+		return;
+
+	device->middlebutton.config.available = evdev_middlebutton_is_available;
+	device->middlebutton.config.set = evdev_middlebutton_set;
+	device->middlebutton.config.get = evdev_middlebutton_get;
+	device->middlebutton.config.get_default = evdev_middlebutton_get_default;
+	device->base.config.middle_emulation = &device->middlebutton.config;
+}
diff --git a/src/evdev.c b/src/evdev.c
index 6f87484..6ca874a 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -143,6 +143,12 @@ evdev_pointer_notify_physical_button(struct evdev_device *device,
 				     int button,
 				     enum libinput_button_state state)
 {
+	if (evdev_middlebutton_filter_button(device,
+					     time,
+					     button,
+					     state))
+			return;
+
 	evdev_pointer_notify_button(device, time, button, state);
 }
 
diff --git a/src/evdev.h b/src/evdev.h
index f2ce9bc..9b1dcc3 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -63,6 +63,29 @@ enum evdev_device_tags {
 	EVDEV_TAG_TOUCHPAD_TRACKPOINT = (1 << 3),
 };
 
+enum evdev_middlebutton_state {
+	MIDDLEBUTTON_IDLE,
+	MIDDLEBUTTON_LEFT_DOWN,
+	MIDDLEBUTTON_RIGHT_DOWN,
+	MIDDLEBUTTON_MIDDLE,
+	MIDDLEBUTTON_LEFT_UP_PENDING,
+	MIDDLEBUTTON_RIGHT_UP_PENDING,
+	MIDDLEBUTTON_IGNORE_LR,
+	MIDDLEBUTTON_IGNORE_L,
+	MIDDLEBUTTON_IGNORE_R,
+	MIDDLEBUTTON_PASSTHROUGH,
+};
+
+enum evdev_middlebutton_event {
+	MIDDLEBUTTON_EVENT_L_DOWN,
+	MIDDLEBUTTON_EVENT_R_DOWN,
+	MIDDLEBUTTON_EVENT_OTHER,
+	MIDDLEBUTTON_EVENT_L_UP,
+	MIDDLEBUTTON_EVENT_R_UP,
+	MIDDLEBUTTON_EVENT_TIMEOUT,
+	MIDDLEBUTTON_EVENT_ALL_UP,
+};
+
 struct mt_slot {
 	int32_t seat_slot;
 	struct device_coords point;
@@ -158,6 +181,18 @@ struct evdev_device {
 		void (*change_to_enabled)(struct evdev_device *device);
 	} left_handed;
 
+	struct {
+		struct libinput_device_config_middle_emulation config;
+		/* middle-button emulation enabled */
+		bool enabled;
+		bool enabled_default;
+		bool want_enabled;
+		enum evdev_middlebutton_state state;
+		struct libinput_timer timer;
+		uint32_t button_mask;
+		uint64_t first_event_time;
+	} middlebutton;
+
 	int dpi; /* HW resolution */
 	struct ratelimit syn_drop_limit; /* ratelimit for SYN_DROPPED logging */
 };
@@ -332,6 +367,17 @@ evdev_device_remove(struct evdev_device *device);
 void
 evdev_device_destroy(struct evdev_device *device);
 
+bool
+evdev_middlebutton_filter_button(struct evdev_device *device,
+				 uint64_t time,
+				 int button,
+				 enum libinput_button_state state);
+
+void
+evdev_init_middlebutton(struct evdev_device *device,
+			bool enabled,
+			bool want_config);
+
 static inline double
 evdev_convert_to_mm(const struct input_absinfo *absinfo, double v)
 {
diff --git a/test/litest.c b/test/litest.c
index 5c4f84d..84b4e2f 100644
--- a/test/litest.c
+++ b/test/litest.c
@@ -1437,6 +1437,12 @@ litest_timeout_edgescroll(void)
 }
 
 void
+litest_timeout_middlebutton(void)
+{
+	msleep(50);
+}
+
+void
 litest_push_event_frame(struct litest_device *dev)
 {
 	assert(!dev->skip_ev_syn);
diff --git a/test/litest.h b/test/litest.h
index 84567be..8cb1121 100644
--- a/test/litest.h
+++ b/test/litest.h
@@ -194,6 +194,7 @@ void litest_timeout_softbuttons(void);
 void litest_timeout_buttonscroll(void);
 void litest_timeout_edgescroll(void);
 void litest_timeout_finger_switch(void);
+void litest_timeout_middlebutton(void);
 
 void litest_push_event_frame(struct litest_device *dev);
 void litest_pop_event_frame(struct litest_device *dev);
diff --git a/test/touchpad.c b/test/touchpad.c
index b06e00d..a64ab0b 100644
--- a/test/touchpad.c
+++ b/test/touchpad.c
@@ -2852,6 +2852,9 @@ START_TEST(touchpad_left_handed_delayed)
 
 	/* left-handed takes effect now */
 	litest_button_click(dev, BTN_RIGHT, 1);
+	libinput_dispatch(li);
+	litest_timeout_middlebutton();
+	libinput_dispatch(li);
 	litest_button_click(dev, BTN_LEFT, 1);
 	libinput_dispatch(li);
 
-- 
2.3.4



More information about the wayland-devel mailing list