Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/kmcaster.git

Add image for unmapped mouse buttons

Author DaveJarvis <email>
Date 2020-07-31 21:24:57 GMT-0700
Commit b06e2c5159c762080ac173aabfabf206d10356bd
Parent c1255fb
src/main/com/whitemagicsoftware/kmcaster/HardwareImages.java
final var stateOff = state( key, SWITCH_RELEASED );
- try {
- final var imageDn = mouseImage( key.toString() );
- mouseStates.put( stateOn, imageDn.getKey() );
- mouseStates.put( stateOff, mouseReleased.getKey() );
- mSwitches.put( key, mouseStates );
- } catch( final Exception e ) {
- // Not all mouse buttons map to images.
- }
+ final var imageDn = mouseImage( key.toString() );
+ mouseStates.put( stateOn, imageDn.getKey() );
+ mouseStates.put( stateOff, mouseReleased.getKey() );
+ mSwitches.put( key, mouseStates );
}
src/main/com/whitemagicsoftware/kmcaster/HardwareSwitch.java
MOUSE_MIDDLE( "2" ),
MOUSE_RIGHT( "3" ),
- MOUSE_REGULAR( "4" ),
+ MOUSE_REGULAR( "regular" ),
KEY_SHIFT( "shift", SHIFT_MASK ),
KEY_CTRL( "ctrl", CTRL_MASK ),
src/main/com/whitemagicsoftware/kmcaster/listeners/MouseListener.java
mSwitches.put( MOUSE_MIDDLE, false );
mSwitches.put( MOUSE_RIGHT, false );
+ mSwitches.put( MOUSE_REGULAR, false );
}
public void nativeMouseWheelMoved( final NativeMouseWheelEvent e ) {
-// System.out.println( "Mouse Scroll: " + e.getWheelRotation() );
+ //dispatchMouseEvent( e, e.getWheelRotation() );
}
/**
* Called to send a mouse event to all listeners.
*
* @param e The mouse event that was most recently triggered.
* @param pressed {@code true} means pressed, {@code false} means released.
*/
private void dispatchMouseEvent(
- final NativeMouseEvent e,
- final boolean pressed ) {
-
+ final NativeMouseEvent e, final boolean pressed ) {
try {
final var id = Integer.toString( e.getButton() );
final var hwSwitch = HardwareSwitch.valueFrom( id );
tryFire( hwSwitch, mSwitches.get( hwSwitch ), pressed );
mSwitches.put( hwSwitch, pressed );
} catch( final Exception ex ) {
// The mouse button wasn't found. This means that there is no visual
- // representation for the button, so the event can be silently ignored.
+ // representation for the button, so pass up the generic brand instead.
+ //tryFire( MOUSE_REGULAR, mSwitches.get( MOUSE_REGULAR ), pressed );
}
}
src/main/resources/images/mouse/all.svg
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- xml:space="default"
- inkscape:export-ydpi="208.03294"
- inkscape:export-xdpi="208.03294"
- inkscape:export-filename="/home/karlo/SRC/apmaaciibai/keymon/veido/icons/hicolor/128x128/apps/key-mon.png"
- version="1.1"
- width="35"
- height="60"
- id="svg1770"
- sodipodi:version="0.32"
- inkscape:version="1.0 (4035a4fb49, 2020-05-01)"
- sodipodi:docname="km.svg">
- <defs
- xml:space="default"
- id="defs3">
- <linearGradient
- xml:space="default"
- id="linearGradient2103-2">
- <stop
- id="stop2105-8"
- offset="0.0000000"
- style="stop-color:#e1e1e1;stop-opacity:1.0000000;" />
- <stop
- id="stop2107-1"
- offset="1.0000000"
- style="stop-color:#a2a2a3;stop-opacity:1.0000000;" />
- </linearGradient>
- <linearGradient
- xml:space="default"
- id="linearGradient2064-0">
- <stop
- id="stop2066-7"
- offset="0.0000000"
- style="stop-color:#b2b2b2;stop-opacity:1.0000000;" />
- <stop
- id="stop2068-8"
- offset="1.0000000"
- style="stop-color:#dcdcde;stop-opacity:1.0000000;" />
- </linearGradient>
- <linearGradient
- xml:space="default"
- id="linearGradient2052-5">
- <stop
- id="stop2054-6"
- offset="0.0000000"
- style="stop-color:#aaaaaa;stop-opacity:1.0000000;" />
- <stop
- id="stop2056-3"
- offset="1.0000000"
- style="stop-color:#c8c8ca;stop-opacity:1.0000000;" />
- </linearGradient>
- <linearGradient
- xml:space="default"
- gradientTransform="scale(1.0058652,0.994169)"
- gradientUnits="userSpaceOnUse"
- xlink:href="#ButtonShadow-2"
- id="linearGradient2961"
- y2="7.0165396"
- x2="45.447727"
- y1="92.539597"
- x1="45.447727" />
- <filter
- xml:space="default"
- style="color-interpolation-filters:sRGB"
- id="filter3689">
- <feGaussianBlur
- xml:space="default"
- stdDeviation="1.71"
- id="feGaussianBlur3691" />
- </filter>
- <linearGradient
- xml:space="default"
- gradientTransform="scale(1.0058652,0.994169)"
- gradientUnits="userSpaceOnUse"
- id="ButtonShadow-2"
- y2="7.0165396"
- x2="45.447727"
- y1="92.539597"
- x1="45.447727">
- <stop
- offset="0"
- style="stop-color:#000000;stop-opacity:1"
- id="stop3750-61" />
- <stop
- offset="1"
- style="stop-color:#000000;stop-opacity:0.58823532"
- id="stop3752-0" />
- </linearGradient>
- <radialGradient
- xml:space="default"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.10386574,0,0,0.2069612,9.6504311,-27.484251)"
- xlink:href="#linearGradient646"
- id="radialGradient644"
- cx="159.49144"
- cy="168.12007"
- r="30.63846"
- fx="159.49144"
- fy="168.12007"
- spreadMethod="reflect" />
- <linearGradient
- xml:space="default"
- id="linearGradient646">
- <stop
- style="stop-color:#b3b3eb;stop-opacity:0;"
- offset="0"
- id="stop647" />
- <stop
- style="stop-color:#000000;stop-opacity:1;"
- offset="1"
- id="stop648" />
- </linearGradient>
- <linearGradient
- xml:space="default"
- gradientTransform="matrix(0.10386574,0,0,0.2069612,9.6504311,-27.484251)"
- xlink:href="#linearGradient640"
- id="linearGradient643"
- y2="162.41747"
- x2="193.62814"
- y1="161.64732"
- x1="193.62866"
- spreadMethod="reflect"
- gradientUnits="userSpaceOnUse" />
- <linearGradient
- xml:space="default"
- id="linearGradient640">
- <stop
- style="stop-color:#333333;stop-opacity:1;"
- offset="0"
- id="stop641" />
- <stop
- style="stop-color:#ffffff;stop-opacity:1;"
- offset="1"
- id="stop642" />
- </linearGradient>
- <radialGradient
- xml:space="default"
- gradientUnits="userSpaceOnUse"
- xlink:href="#linearGradient650"
- id="radialGradient656"
- cx="193.40065"
- cy="181.62012"
- r="68.141403"
- fx="193.40065"
- fy="181.62012"
- spreadMethod="reflect"
- gradientTransform="matrix(0.13524217,0,0,0.34161946,8.5771889,-48.069476)" />
- <linearGradient
- xml:space="default"
- id="linearGradient650">
- <stop
- style="stop-color:#ffffff;stop-opacity:1;"
- offset="0"
- id="stop651" />
- <stop
- style="stop-color:#666;stop-opacity:1;"
- offset="1"
- id="stop652" />
- </linearGradient>
- <radialGradient
- xml:space="default"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.14849217,0,0,0.25526745,8.1706692,-36.461377)"
- r="252.08369"
- fy="170.14384"
- fx="85.527824"
- cy="170.14384"
- cx="85.527824"
- spreadMethod="reflect"
- id="radialGradient922"
- xlink:href="#linearGradient650"
- inkscape:collect="always" />
- <linearGradient
- x1="193.62866"
- y1="161.64732"
- x2="193.62814"
- y2="162.41747"
- id="linearGradient643-8"
- xlink:href="#linearGradient640"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.13405211,0,0,0.28320309,8.3022053,-37.262428)"
- spreadMethod="reflect" />
- <radialGradient
- cx="158.02565"
- cy="169.19684"
- r="31.162628"
- fx="158.02565"
- fy="169.19684"
- id="radialGradient644-1"
- xlink:href="#linearGradient646"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.13493192,0,0,0.28135646,8.3022053,-37.262428)"
- spreadMethod="reflect" />
- </defs>
- <sodipodi:namedview
- inkscape:snap-global="true"
- inkscape:document-rotation="0"
- fit-margin-bottom="0"
- fit-margin-right="0"
- fit-margin-left="0"
- fit-margin-top="0"
- inkscape:guide-bbox="true"
- showguides="true"
- inkscape:window-maximized="1"
- showgrid="false"
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="11.914749"
- inkscape:cx="17.283099"
- inkscape:cy="19.45066"
- inkscape:current-layer="layer1"
- inkscape:window-width="1280"
- inkscape:window-height="731"
- inkscape:window-x="0"
- inkscape:window-y="27" />
- <metadata
- xml:space="default"
- id="metadata4">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
- <cc:license
- rdf:resource="http://creativecommons.org/licenses/by/4.0/" />
- <dc:creator>
- <cc:Agent>
- <dc:title>Scott Kirkwood</dc:title>
- </cc:Agent>
- </dc:creator>
- </cc:Work>
- <cc:License
- rdf:about="http://creativecommons.org/licenses/by/4.0/">
- <cc:permits
- rdf:resource="http://creativecommons.org/ns#Reproduction" />
- <cc:permits
- rdf:resource="http://creativecommons.org/ns#Distribution" />
- <cc:requires
- rdf:resource="http://creativecommons.org/ns#Notice" />
- <cc:requires
- rdf:resource="http://creativecommons.org/ns#Attribution" />
- <cc:permits
- rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
- </cc:License>
- </rdf:RDF>
- </metadata>
- <g
- transform="translate(-14.600203,0.65410205)"
- xml:space="default"
- inkscape:label="Pele"
- inkscape:groupmode="layer"
- id="layer1">
- <g
- id="g4984">
- <path
- xml:space="default"
- inkscape:connector-curvature="0"
- style="font-size:12px;fill:url(#radialGradient922);fill-rule:evenodd;stroke:#000000;stroke-width:0.531164;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.197719"
- d="m 32.102757,59.074558 c -14.9051,0 -17.158583,-12.110048 -17.004415,-15.946774 v 0 0 0 0 0 c 0.229462,-3.618822 0.420338,-18.175971 -0.238058,-30.4337 0.167759,-13.3962921 11.350345,-13.07608046 17.239979,-13.07608046 5.8896,0 17.072185,-0.32021164 17.239944,13.07608046 -0.658378,12.257729 -0.467513,26.814878 -0.238062,30.432919 v 0 0 0 0 0 c 0.154201,3.836723 -2.099296,15.946773 -17.004396,15.946773"
- id="path617"
- sodipodi:nodetypes="ccccccccccccccccc" />
- <ellipse
- ry="8.0322866"
- rx="3.1798654"
- cy="10.963297"
- cx="32.083252"
- xml:space="default"
- style="fill:url(#radialGradient656);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.214945"
- id="path655" />
- <path
- xml:space="default"
- inkscape:connector-curvature="0"
- style="fill:none;stroke:#484848;stroke-width:0.531251;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="m 32.105492,21.771798 c -8.160819,0 -12.277529,0.18287 -14.373831,0.37127 -2.0963,0.188399 -2.038781,0.398525 -2.251373,0.404438"
- id="path619"
- sodipodi:nodetypes="csc" />
- <path
- sodipodi:nodetypes="csc"
- id="path2578"
- d="m 32.103506,21.771798 c 8.16082,0 12.277531,0.18287 14.373831,0.37127 2.096299,0.188399 2.038781,0.398525 2.251373,0.404438"
- style="fill:none;stroke:#484848;stroke-width:0.531251;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- inkscape:connector-curvature="0"
- xml:space="default" />
- <path
- xml:space="default"
- inkscape:connector-curvature="0"
- style="font-size:12px;fill:none;stroke:#484848;stroke-width:0.531164;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="M 32.098199,-0.10793425 V 21.608523"
- id="path618"
- sodipodi:nodetypes="cc" />
- <path
- style="font-size:12px;fill:#0093ff;fill-opacity:0.25098;fill-rule:evenodd;stroke:none;stroke-width:0.19326"
- id="path617-7"
- d="M 30.832406,-0.14650446 C 24.858485,-0.13257941 15.15915,0.372633 15.096753,12.961188 c 0.144543,3.341883 0.282005,6.896484 0.383535,9.586318 0.490924,-0.116548 -9.75e-4,-0.741237 16.357829,-0.743723 v -5.799377 c -1.191722,-0.196254 -2.130102,-2.307949 -2.130102,-4.887322 0,-2.5793733 0.93838,-4.6910678 2.130104,-4.887322 v -6.37629092 c -0.322607,-1.6042e-4 -0.655326,-8.2229e-4 -1.005708,0 z"
- sodipodi:nodetypes="cccccscccc" />
- <path
- sodipodi:nodetypes="cccccscccc"
- d="m 33.35819,-0.14650446 c 5.973921,0.013925 15.673256,0.51913746 15.735653,13.10769246 -0.144543,3.341883 -0.282005,6.896484 -0.383535,9.586318 -0.490924,-0.116548 9.75e-4,-0.741237 -16.357829,-0.743723 v -5.799377 c 1.191722,-0.196254 2.130102,-2.307949 2.130102,-4.887322 0,-2.5793733 -0.93838,-4.6910678 -2.130104,-4.887322 v -6.37629092 c 0.322607,-1.6042e-4 0.655326,-8.2229e-4 1.005708,0 z"
- id="path3337"
- style="font-size:12px;fill:#40ff00;fill-opacity:0.25098;fill-rule:evenodd;stroke:none;stroke-width:0.19326" />
- <path
- style="fill:url(#linearGradient643-8);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.194843"
- id="path639"
- d="m 34.433613,11.065348 a 2.3354162,4.9338803 0 1 1 -4.670832,0 2.3354162,4.9338803 0 1 1 4.670832,0 z" />
- <path
- style="fill:url(#radialGradient644-1);fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.107164;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="path645"
- d="m 34.433613,11.065348 a 2.3354162,4.9338803 0 1 1 -4.670832,0 2.3354162,4.9338803 0 1 1 4.670832,0 z" />
- <path
- d="m 34.433613,11.065348 a 2.3354162,4.9338803 0 1 1 -4.670832,0 2.3354162,4.9338803 0 1 1 4.670832,0 z"
- id="path4970"
- style="fill:#ff1400;fill-opacity:0.50196081;fill-rule:evenodd;stroke:#ff1400;stroke-width:0.107164;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.50196081" />
- </g>
- </g>
- <g
- xml:space="default"
- style="display:inline"
- transform="translate(-14.600203,0.65410205)"
- inkscape:label="Burts"
- id="layer2"
- inkscape:groupmode="layer" />
-</svg>
src/main/resources/images/mouse/regular.svg
-
+<svg viewBox="0 0 35 60" xmlns="http://www.w3.org/2000/svg"><path d="m17.502 59.388c-14.667 0-16.886-11.917-16.733-15.693.2258-3.5611.06598-20.108.06598-20.108s-.03406-.98114 16.665-.98698c16.626 0 16.665.98698 16.665.98698s-.15981 16.547.06598 20.107c.15174 3.7756-2.0658 15.693-16.733 15.693" fill="#feff00" fill-opacity=".25098" fill-rule="evenodd"/></svg>
Delta 11 lines added, 352 lines removed, 341-line decrease