Skip to content

Commit 7ea0b74

Browse files
committed
Finish v1.1.1
2 parents 2bfc442 + 6952286 commit 7ea0b74

File tree

22 files changed

+116
-110
lines changed

22 files changed

+116
-110
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
Changelog for Remote Support Tool
22
=================================
33

4+
1.1.1 (22 Mar 2019)
5+
-------------------
6+
7+
- fixed [issue #28](https://github.com/OpenIndex/RemoteSupportTool/issues/28): Uppercase characters are printed in lowercase for Linux customers
8+
- fixed [issue #29](https://github.com/OpenIndex/RemoteSupportTool/issues/29): Wrong mouse position on multi monitor setups
9+
- fixed [issue #30](https://github.com/OpenIndex/RemoteSupportTool/issues/30): Wrong screen information shown in customer tool
10+
- fixed [issue #31](https://github.com/OpenIndex/RemoteSupportTool/issues/31): Staff tool on macOS doesn't send characters typed with option key
11+
12+
413
1.1.0 (20 Mar 2019)
514
-------------------
615

Core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<artifactId>RemoteSupportTool</artifactId>
99
<groupId>de.openindex.support</groupId>
10-
<version>1.1.0</version>
10+
<version>1.1.1</version>
1111
</parent>
1212

1313
<artifactId>RemoteSupportTool-Core</artifactId>

Core/src/main/java/de/openindex/support/core/AppUtils.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,6 @@ public static void initTruststore(File defaultTruststore, String defaultPassword
261261
System.getProperty(TRUSTSTORE_PASSWORD), defaultPassword));
262262
}
263263

264-
public static boolean isAsciiCharacter(char character) {
265-
return character == ' ' || // is space
266-
(character >= 48 && character <= 57) || // is number
267-
(character >= 65 && character <= 90) || // is upper case letter
268-
(character >= 97 && character <= 122); // is lower case letter
269-
}
270-
271264
public static URL resource(String file) {
272265
return AppUtils.class.getResource("resources/" + file);
273266
}

Customer/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<artifactId>RemoteSupportTool</artifactId>
99
<groupId>de.openindex.support</groupId>
10-
<version>1.1.0</version>
10+
<version>1.1.1</version>
1111
</parent>
1212

1313
<artifactId>RemoteSupportTool-Customer</artifactId>

Customer/src/main/java/de/openindex/support/customer/CustomerApplication.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import java.awt.Desktop;
3838
import java.awt.GraphicsConfiguration;
3939
import java.awt.GraphicsDevice;
40+
import java.awt.Rectangle;
4041
import java.awt.event.ActionEvent;
4142
import java.awt.event.ActionListener;
4243
import java.awt.event.KeyEvent;
@@ -430,13 +431,14 @@ public void processReceivedObject(Serializable object) {
430431
} else if (object instanceof MouseMoveRequest) {
431432

432433
final MouseMoveRequest request = (MouseMoveRequest) object;
433-
final int x;
434-
final int y;
434+
final GraphicsConfiguration screenConfiguration = screen.getDefaultConfiguration();
435+
436+
int x;
437+
int y;
435438

436439
// On Windows systems we need to convert the coordinates
437440
// according to the current screen scaling factor.
438441
if (SystemUtils.IS_OS_WINDOWS) {
439-
final GraphicsConfiguration screenConfiguration = screen.getDefaultConfiguration();
440442
final AffineTransform transform = screenConfiguration.getDefaultTransform();
441443
final double scaleX = (transform != null && transform.getScaleX() > 0) ?
442444
transform.getScaleX() : 1;
@@ -450,6 +452,16 @@ public void processReceivedObject(Serializable object) {
450452
y = request.y;
451453
}
452454

455+
// Calculate absolute coordinates for the selected screen.
456+
// Required for multi monitor setups.
457+
Rectangle bounds = screenConfiguration.getBounds();
458+
//LOGGER.debug("screen bounds {} x {}", bounds.x, bounds.y);
459+
//LOGGER.debug("screen size {} x {}", bounds.width, bounds.height);
460+
//LOGGER.debug("mouse coords {} x {}", x, y);
461+
x += bounds.x;
462+
y += bounds.y;
463+
//LOGGER.debug("move mouse to {} x {}", x, y);
464+
453465
robot.mouseMove(x, y);
454466

455467
} else if (object instanceof MousePressRequest) {

Customer/src/main/java/de/openindex/support/customer/CustomerFrame.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@
2323
import java.awt.Dimension;
2424
import java.awt.FlowLayout;
2525
import java.awt.Font;
26+
import java.awt.GraphicsConfiguration;
2627
import java.awt.GraphicsDevice;
2728
import java.awt.GraphicsEnvironment;
29+
import java.awt.Rectangle;
2830
import java.awt.event.WindowAdapter;
2931
import java.awt.event.WindowEvent;
3032
import javax.swing.BorderFactory;
@@ -153,8 +155,12 @@ public void changedUpdate(DocumentEvent e) {
153155
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
154156
final JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
155157
final GraphicsDevice screen = (GraphicsDevice) value;
158+
final GraphicsConfiguration cfg = screen.getDefaultConfiguration();
159+
final Rectangle bounds = cfg.getBounds();
156160

157-
label.setText(screen.getIDstring() + " (" + screen.getDisplayMode().toString() + ")");
161+
label.setText(screen.getIDstring() + " ("
162+
+ bounds.width + "x" + bounds.height + "@" + cfg.getColorModel().getPixelSize() + "bpp; "
163+
+ "x=" + bounds.x + "; y=" + bounds.y + ")");
158164
return label;
159165
}
160166
});

Customer/src/main/java/de/openindex/support/customer/utils/LinuxUtils.java

Lines changed: 46 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import com.sun.jna.NativeLong;
2020
import com.sun.jna.platform.unix.X11;
2121
import com.sun.jna.ptr.IntByReference;
22-
import de.openindex.support.core.AppUtils;
2322
import org.apache.commons.lang3.StringUtils;
2423
import org.slf4j.Logger;
2524
import org.slf4j.LoggerFactory;
@@ -138,72 +137,59 @@ private static void sendTextViaX11(String text) throws LinuxException {
138137
X11.XFlush(display);
139138

140139
for (int i = 0; i < text.length(); i++) {
141-
char c = text.charAt(i);
142-
//LOGGER.debug("printing " + c);
143-
144-
145-
//int value = StandardCharsets.UTF_8.encode(String.valueOf(c)).getInt();
146-
//LOGGER.debug("> value " + value);
147-
String unicode = String.format("U%04x", (int) c);
148-
//LOGGER.debug("> code " + unicode);
149-
150-
//X11.KeySym sym = X11.XStringToKeysym(String.valueOf(c));
151-
X11.KeySym sym = X11.XStringToKeysym(unicode);
152-
153-
//int code = (sym != null) ? X11.XKeysymToKeycode(display, sym) : 0x00D1;
154-
int code = X11.XKeysymToKeycode(display, sym);
155-
156-
X11.KeySym[] resetKeySym = null;
157-
if (!AppUtils.isAsciiCharacter(c)) {
158-
//LOGGER.debug("> use scratch");
159-
//LOGGER.debug("> " + X11.XKeysymToString(sym));
160-
161-
resetKeySym = new X11.KeySym[keysymsPerKeycode.getValue()];
162-
for (int j = 0; j < resetKeySym.length; j++) {
163-
resetKeySym[j] = X11.XKeycodeToKeysym(display, (byte) scratch_keycode, j);
164-
}
165-
166-
X11.XChangeKeyboardMapping(
167-
display,
168-
scratch_keycode,
169-
2,
170-
new X11.KeySym[]{sym, sym},
171-
1);
172-
code = scratch_keycode;
173-
}
174-
175-
//LOGGER.debug("> " + code);
176-
177-
if (code > 0) {
178-
//XTEST.XTestFakeKeyEvent(display, code, false, new NativeLong(0));
179-
//X11.XFlush(display);
140+
final char character = text.charAt(i);
141+
//LOGGER.debug("printing {}", character);
180142

181-
XTEST.XTestFakeKeyEvent(display, code, true, new NativeLong(0));
182-
//X11.XFlush(display);
183-
X11.XSync(display, false);
143+
// get unicode formatted string
144+
final String unicode = String.format("U%04x", (int) character);
145+
//LOGGER.debug("> code {}", unicode);
184146

185-
XTEST.XTestFakeKeyEvent(display, code, false, new NativeLong(0));
186-
//X11.XFlush(display);
187-
X11.XSync(display, false);
147+
// get keysym for the unicode string
148+
final X11.KeySym sym = X11.XStringToKeysym(unicode);
188149

189-
//noinspection CatchMayIgnoreException
190-
try {
191-
Thread.sleep(100);
192-
} catch (Exception ex) {
193-
}
150+
// remember the old value before the keysym is overwritten
151+
final X11.KeySym[] resetKeySym = new X11.KeySym[keysymsPerKeycode.getValue()];
152+
for (int j = 0; j < resetKeySym.length; j++) {
153+
resetKeySym[j] = X11.XKeycodeToKeysym(display, (byte) scratch_keycode, j);
194154
}
195155

196-
if (resetKeySym != null) {
197-
X11.XChangeKeyboardMapping(
198-
display,
199-
scratch_keycode,
200-
resetKeySym.length,
201-
resetKeySym,
202-
1);
203-
}
156+
// register keysym for the unicode string
157+
X11.XChangeKeyboardMapping(
158+
display,
159+
scratch_keycode,
160+
2,
161+
new X11.KeySym[]{sym, sym},
162+
1);
163+
164+
//XTEST.XTestFakeKeyEvent(display, code, false, new NativeLong(0));
165+
//X11.XFlush(display);
166+
167+
// post event for key press
168+
XTEST.XTestFakeKeyEvent(display, scratch_keycode, true, new NativeLong(0));
169+
//X11.XFlush(display);
170+
X11.XSync(display, false);
171+
172+
// post event for key release
173+
XTEST.XTestFakeKeyEvent(display, scratch_keycode, false, new NativeLong(0));
174+
//X11.XFlush(display);
175+
X11.XSync(display, false);
176+
177+
//noinspection CatchMayIgnoreException
178+
//try {
179+
// Thread.sleep(50);
180+
//} catch (Exception ex) {
181+
//}
182+
183+
// reset the keysym to the old value before it was overwritten
184+
X11.XChangeKeyboardMapping(
185+
display,
186+
scratch_keycode,
187+
resetKeySym.length,
188+
resetKeySym,
189+
1);
204190
}
205191

206-
//X11.XFlush(display);
192+
X11.XFlush(display);
207193
//X11.XSync(display, false);
208194
X11.XCloseDisplay(display);
209195
}

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Remote Support Tool 1.1.0
1+
Remote Support Tool 1.1.1
22
=========================
33

44
*Remote Support Tool* is an easy single click solution for remote maintenance.
@@ -162,6 +162,8 @@ The following third party components are bundled into the application (in alphab
162162
[(LGPL 2.1)](https://web.archive.org/web/20101122171611/http://everaldo.com/crystal/?action=license)
163163
- [imgscalr](https://github.com/rkalla/imgscalr) rev-8ed3644
164164
[(Apache License 2.0)](https://raw.githubusercontent.com/rkalla/imgscalr/master/LICENSE)
165+
- [Java Native Access](https://github.com/java-native-access/jna) 5.2.0
166+
[(Apache License 2.0)](https://raw.githubusercontent.com/java-native-access/jna/master/LICENSE)
165167
- [JSch](http://www.jcraft.com/jsch/) 0.1.55
166168
[(BSD)](http://www.jcraft.com/jsch/LICENSE.txt)
167169
- [JZlib](http://www.jcraft.com/jzlib/) 1.1.3

Staff/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<artifactId>RemoteSupportTool</artifactId>
99
<groupId>de.openindex.support</groupId>
10-
<version>1.1.0</version>
10+
<version>1.1.1</version>
1111
</parent>
1212

1313
<artifactId>RemoteSupportTool-Staff</artifactId>

Staff/src/main/java/de/openindex/support/staff/StaffApplication.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ protected synchronized void doHandleKeyPress(KeyEvent e) {
578578
}
579579

580580
// Press other keys, if they are pressed together with a modifier key.
581-
else if (e.isControlDown() || e.isAltDown() || e.isMetaDown() || windowsKeyDown) {
581+
else if (e.isControlDown() || e.isMetaDown() || windowsKeyDown || (!SystemUtils.IS_OS_MAC && e.isAltDown())) {
582582
//LOGGER.debug("press key \"{}\" ({})", keyCode, KeyEvent.getKeyText(keyCode));
583583
handler.sendKeyPress(keyCode);
584584
if (!pressedKeys.contains(keyCode))
@@ -653,7 +653,7 @@ protected synchronized void doHandleKeyRelease(KeyEvent e) {
653653
}
654654

655655
// Release other keys, if they are pressed together with a modifier key.
656-
else if (e.isControlDown() || e.isAltDown() || e.isMetaDown() || windowsKeyDown || pressedKeys.contains(keyCode)) {
656+
else if (e.isControlDown() || e.isMetaDown() || windowsKeyDown || (!SystemUtils.IS_OS_MAC && e.isAltDown()) || pressedKeys.contains(keyCode)) {
657657
//LOGGER.debug("release key \"{}\" ({})", keyCode, KeyEvent.getKeyText(keyCode));
658658
handler.sendKeyRelease(keyCode);
659659
pressedKeys.remove((Integer) keyCode);
@@ -673,18 +673,20 @@ protected synchronized void doHandleKeyTyped(KeyEvent e) {
673673
if (handler == null) return;
674674
//LOGGER.debug("key typed: " + e.paramString());
675675
final char keyChar = e.getKeyChar();
676-
final int keyValue = (int) keyChar;
677676

678677
// Don't type non printable characters.
679-
//if (keyValue < 33 || keyValue == 127 || keyChar == KeyEvent.CHAR_UNDEFINED)
680-
if (keyChar == KeyEvent.CHAR_UNDEFINED || Character.isWhitespace(keyChar) || Character.isISOControl(keyChar) || Character.isIdentifierIgnorable(keyChar))
678+
if (keyChar == KeyEvent.CHAR_UNDEFINED || Character.isWhitespace(keyChar) || Character.isISOControl(keyChar) || Character.isIdentifierIgnorable(keyChar)) {
679+
//LOGGER.debug("non printable {} / {}", Character.isWhitespace(keyChar), Character.isISOControl(keyChar));
681680
return;
681+
}
682682

683683
// Don't type a character, if a modifier key is pressed at the same time.
684-
if (e.isControlDown() || e.isAltDown() || e.isMetaDown() || windowsKeyDown)
684+
if (e.isControlDown() || e.isMetaDown() || windowsKeyDown || (!SystemUtils.IS_OS_MAC && e.isAltDown())) {
685+
//LOGGER.debug("modifier {} / {} / {} / {}", e.isControlDown(), e.isAltDown(), e.isMetaDown(), windowsKeyDown);
685686
return;
687+
}
686688

687-
//LOGGER.debug("type character \"{}\" ({})", keyChar, keyValue);
689+
//LOGGER.debug("type character \"{}\" ({})", keyChar, e.getKeyCode());
688690
handler.sendKeyType(keyChar);
689691
e.consume();
690692
}

0 commit comments

Comments
 (0)