x11vnc: touchscreen uinput support and Java viewer mousewheel support. See x11vnc/ChangeLog for rest.

pull/1/head
runge 14 years ago
parent d4fabc217e
commit 365a22c63c

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -2964,6 +2964,10 @@ if [ "X$use_ssh" = "X1" ]; then
fi
echo "ssh_pid='$pssh'"; echo
if [ "X$use_sshssl" = "X" -a "X$getport" = "X" ]; then
if [ "X$SSVNC_EXTRA_COMMAND" != "X" ]; then
(sh -c "$SSVNC_EXTRA_COMMAND") &
echo "($SSVNC_EXTRA_COMMAND) &"; echo
fi
echo "Running viewer:"
trap "final" 0 2 15
@ -3334,6 +3338,10 @@ if [ "X$direct_connect" != "X" ]; then
echo "T sleep $SSVNC_EXTRA_SLEEP"
sleep $SSVNC_EXTRA_SLEEP
fi
if [ "X$SSVNC_EXTRA_COMMAND" != "X" ]; then
(sh -c "$SSVNC_EXTRA_COMMAND") &
echo "($SSVNC_EXTRA_COMMAND) &"; echo
fi
if [ "X$reverse" = "X" ]; then
hostdisp="$host:$disp"
if [ "X$SSVNC_ULTRA_DSM" != "X" ]; then
@ -3568,6 +3576,10 @@ if [ "X$SSVNC_EXTRA_SLEEP" != "X" ]; then
echo "sleep $SSVNC_EXTRA_SLEEP"
sleep $SSVNC_EXTRA_SLEEP
fi
if [ "X$SSVNC_EXTRA_COMMAND" != "X" ]; then
(sh -c "$SSVNC_EXTRA_COMMAND") &
echo "($SSVNC_EXTRA_COMMAND) &"; echo
fi
if [ "X$reverse" = "X" ]; then
if [ "X$NEED_VENCRYPT_VIEWER_BRIDGE" = "X1" -a "X$ptmp" != "X" ] ; then

@ -1,6 +1,6 @@
--- vnc_javasrc.orig/VncCanvas.java 2004-10-10 02:15:54.000000000 -0400
+++ vnc_javasrc/VncCanvas.java 2006-03-27 22:34:02.000000000 -0500
@@ -28,6 +28,7 @@
+++ vnc_javasrc/VncCanvas.java 2010-11-30 21:01:15.000000000 -0500
@@ -28,13 +28,14 @@
import java.lang.*;
import java.util.zip.*;
@ -8,6 +8,14 @@
//
// VncCanvas is a subclass of Canvas which draws a VNC desktop on it.
//
class VncCanvas extends Canvas
- implements KeyListener, MouseListener, MouseMotionListener {
+ implements KeyListener, MouseListener, MouseMotionListener, MouseWheelListener {
VncViewer viewer;
RfbProto rfb;
@@ -81,6 +82,20 @@
cm8 = new DirectColorModel(8, 7, (7 << 3), (3 << 6));
cm24 = new DirectColorModel(24, 0xFF0000, 0x00FF00, 0x0000FF);
@ -29,7 +37,53 @@
colors = new Color[256];
for (int i = 0; i < 256; i++)
colors[i] = new Color(cm8.getRGB(i));
@@ -1387,9 +1402,9 @@
@@ -169,6 +184,7 @@
inputEnabled = true;
addMouseListener(this);
addMouseMotionListener(this);
+ addMouseWheelListener(this);
if (viewer.showControls) {
viewer.buttonPanel.enableRemoteAccessControls(true);
}
@@ -177,6 +193,7 @@
inputEnabled = false;
removeMouseListener(this);
removeMouseMotionListener(this);
+ removeMouseWheelListener(this);
if (viewer.showControls) {
viewer.buttonPanel.enableRemoteAccessControls(false);
}
@@ -1190,6 +1207,9 @@
public void mouseDragged(MouseEvent evt) {
processLocalMouseEvent(evt, true);
}
+ public void mouseWheelMoved(MouseWheelEvent evt) {
+ processLocalMouseWheelEvent(evt);
+ }
public void processLocalKeyEvent(KeyEvent evt) {
if (viewer.rfb != null && rfb.inNormalProtocol) {
@@ -1221,6 +1241,19 @@
evt.consume();
}
+ public void processLocalMouseWheelEvent(MouseWheelEvent evt) {
+ if (viewer.rfb != null && rfb.inNormalProtocol) {
+ synchronized(rfb) {
+ try {
+ rfb.writeWheelEvent(evt);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ rfb.notify();
+ }
+ }
+ }
+
public void processLocalMouseEvent(MouseEvent evt, boolean moved) {
if (viewer.rfb != null && rfb.inNormalProtocol) {
if (moved) {
@@ -1387,9 +1420,9 @@
result = cm8.getRGB(pixBuf[i]);
} else {
result = 0xFF000000 |
@ -42,7 +96,7 @@
}
} else {
result = 0; // Transparent pixel
@@ -1403,9 +1418,9 @@
@@ -1403,9 +1436,9 @@
result = cm8.getRGB(pixBuf[i]);
} else {
result = 0xFF000000 |

@ -1,4 +1,4 @@
diff -x VncCanvas.java -Naur vnc_javasrc.orig/Makefile vnc_javasrc/Makefile
diff -Naur vnc_javasrc.orig/Makefile vnc_javasrc/Makefile
--- vnc_javasrc.orig/Makefile 2004-03-04 08:34:25.000000000 -0500
+++ vnc_javasrc/Makefile 2010-05-18 20:56:26.000000000 -0400
@@ -4,6 +4,7 @@
@ -44,9 +44,9 @@ diff -x VncCanvas.java -Naur vnc_javasrc.orig/Makefile vnc_javasrc/Makefile
export:: $(CLASSES) $(ARCHIVE) $(PAGES)
@$(ExportJavaClasses)
diff -x VncCanvas.java -Naur vnc_javasrc.orig/RfbProto.java vnc_javasrc/RfbProto.java
diff -Naur vnc_javasrc.orig/RfbProto.java vnc_javasrc/RfbProto.java
--- vnc_javasrc.orig/RfbProto.java 2004-03-04 08:34:25.000000000 -0500
+++ vnc_javasrc/RfbProto.java 2010-03-27 17:58:37.000000000 -0400
+++ vnc_javasrc/RfbProto.java 2010-11-30 22:05:12.000000000 -0500
@@ -199,7 +199,21 @@
host = h;
port = p;
@ -79,7 +79,46 @@ diff -x VncCanvas.java -Naur vnc_javasrc.orig/RfbProto.java vnc_javasrc/RfbProto
}
serverMajor = (b[4] - '0') * 100 + (b[5] - '0') * 10 + (b[6] - '0');
@@ -992,6 +1006,19 @@
@@ -892,6 +906,38 @@
final static int ALT_MASK = InputEvent.ALT_MASK;
+ void writeWheelEvent(MouseWheelEvent evt) throws IOException {
+
+ eventBufLen = 0;
+
+ int x = evt.getX();
+ int y = evt.getY();
+
+ if (x < 0) x = 0;
+ if (y < 0) y = 0;
+
+ int ptrmask;
+
+ int clicks = evt.getWheelRotation();
+ System.out.println("writeWheelEvent: clicks: " + clicks);
+ if (clicks > 0) {
+ ptrmask = 16;
+ } else if (clicks < 0) {
+ ptrmask = 8;
+ } else {
+ return;
+ }
+
+ eventBuf[eventBufLen++] = (byte) PointerEvent;
+ eventBuf[eventBufLen++] = (byte) ptrmask;
+ eventBuf[eventBufLen++] = (byte) ((x >> 8) & 0xff);
+ eventBuf[eventBufLen++] = (byte) (x & 0xff);
+ eventBuf[eventBufLen++] = (byte) ((y >> 8) & 0xff);
+ eventBuf[eventBufLen++] = (byte) (y & 0xff);
+
+ os.write(eventBuf, 0, eventBufLen);
+ }
+
//
// Write a pointer event message. We may need to send modifier key events
// around it to set the correct modifier state.
@@ -992,6 +1038,19 @@
boolean down = (evt.getID() == KeyEvent.KEY_PRESSED);
int key;
@ -99,7 +138,7 @@ diff -x VncCanvas.java -Naur vnc_javasrc.orig/RfbProto.java vnc_javasrc/RfbProto
if (evt.isActionKey()) {
//
@@ -1025,6 +1052,13 @@
@@ -1025,6 +1084,13 @@
return;
}
@ -113,7 +152,7 @@ diff -x VncCanvas.java -Naur vnc_javasrc.orig/RfbProto.java vnc_javasrc/RfbProto
} else {
//
@@ -1036,6 +1070,7 @@
@@ -1036,6 +1102,7 @@
key = keyChar;
@ -121,7 +160,7 @@ diff -x VncCanvas.java -Naur vnc_javasrc.orig/RfbProto.java vnc_javasrc/RfbProto
if (key < 0x20) {
if (evt.isControlDown()) {
key += 0x60;
@@ -1121,6 +1156,16 @@
@@ -1121,6 +1188,16 @@
int oldModifiers = 0;
void writeModifierKeyEvents(int newModifiers) {
@ -138,7 +177,7 @@ diff -x VncCanvas.java -Naur vnc_javasrc.orig/RfbProto.java vnc_javasrc/RfbProto
if ((newModifiers & CTRL_MASK) != (oldModifiers & CTRL_MASK))
writeKeyEvent(0xffe3, (newModifiers & CTRL_MASK) != 0);
diff -x VncCanvas.java -Naur vnc_javasrc.orig/SSLSocketToMe.java vnc_javasrc/SSLSocketToMe.java
diff -Naur vnc_javasrc.orig/SSLSocketToMe.java vnc_javasrc/SSLSocketToMe.java
--- vnc_javasrc.orig/SSLSocketToMe.java 1969-12-31 19:00:00.000000000 -0500
+++ vnc_javasrc/SSLSocketToMe.java 2010-07-10 19:18:06.000000000 -0400
@@ -0,0 +1,2067 @@
@ -2209,7 +2248,119 @@ diff -x VncCanvas.java -Naur vnc_javasrc.orig/SSLSocketToMe.java vnc_javasrc/SSL
+ private Base64Coder() {}
+
+}
diff -x VncCanvas.java -Naur vnc_javasrc.orig/VncViewer.java vnc_javasrc/VncViewer.java
diff -Naur vnc_javasrc.orig/VncCanvas.java vnc_javasrc/VncCanvas.java
--- vnc_javasrc.orig/VncCanvas.java 2004-10-10 02:15:54.000000000 -0400
+++ vnc_javasrc/VncCanvas.java 2010-11-30 21:01:15.000000000 -0500
@@ -28,13 +28,14 @@
import java.lang.*;
import java.util.zip.*;
+import java.util.Collections;
//
// VncCanvas is a subclass of Canvas which draws a VNC desktop on it.
//
class VncCanvas extends Canvas
- implements KeyListener, MouseListener, MouseMotionListener {
+ implements KeyListener, MouseListener, MouseMotionListener, MouseWheelListener {
VncViewer viewer;
RfbProto rfb;
@@ -81,6 +82,20 @@
cm8 = new DirectColorModel(8, 7, (7 << 3), (3 << 6));
cm24 = new DirectColorModel(24, 0xFF0000, 0x00FF00, 0x0000FF);
+ // kludge to not show any Java cursor in the canvas since we are
+ // showing the soft cursor (should be a user setting...)
+ Cursor dot = Toolkit.getDefaultToolkit().createCustomCursor(
+ Toolkit.getDefaultToolkit().createImage(new byte[4]), new Point(0,0),
+ "dot");
+ this.setCursor(dot);
+
+ // while we are at it... get rid of the keyboard traversals that
+ // make it so we can't type a Tab character:
+ this.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
+ Collections.EMPTY_SET);
+ this.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
+ Collections.EMPTY_SET);
+
colors = new Color[256];
for (int i = 0; i < 256; i++)
colors[i] = new Color(cm8.getRGB(i));
@@ -169,6 +184,7 @@
inputEnabled = true;
addMouseListener(this);
addMouseMotionListener(this);
+ addMouseWheelListener(this);
if (viewer.showControls) {
viewer.buttonPanel.enableRemoteAccessControls(true);
}
@@ -177,6 +193,7 @@
inputEnabled = false;
removeMouseListener(this);
removeMouseMotionListener(this);
+ removeMouseWheelListener(this);
if (viewer.showControls) {
viewer.buttonPanel.enableRemoteAccessControls(false);
}
@@ -1190,6 +1207,9 @@
public void mouseDragged(MouseEvent evt) {
processLocalMouseEvent(evt, true);
}
+ public void mouseWheelMoved(MouseWheelEvent evt) {
+ processLocalMouseWheelEvent(evt);
+ }
public void processLocalKeyEvent(KeyEvent evt) {
if (viewer.rfb != null && rfb.inNormalProtocol) {
@@ -1221,6 +1241,19 @@
evt.consume();
}
+ public void processLocalMouseWheelEvent(MouseWheelEvent evt) {
+ if (viewer.rfb != null && rfb.inNormalProtocol) {
+ synchronized(rfb) {
+ try {
+ rfb.writeWheelEvent(evt);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ rfb.notify();
+ }
+ }
+ }
+
public void processLocalMouseEvent(MouseEvent evt, boolean moved) {
if (viewer.rfb != null && rfb.inNormalProtocol) {
if (moved) {
@@ -1387,9 +1420,9 @@
result = cm8.getRGB(pixBuf[i]);
} else {
result = 0xFF000000 |
- (pixBuf[i * 4 + 1] & 0xFF) << 16 |
- (pixBuf[i * 4 + 2] & 0xFF) << 8 |
- (pixBuf[i * 4 + 3] & 0xFF);
+ (pixBuf[i * 4 + 2] & 0xFF) << 16 |
+ (pixBuf[i * 4 + 1] & 0xFF) << 8 |
+ (pixBuf[i * 4 + 0] & 0xFF);
}
} else {
result = 0; // Transparent pixel
@@ -1403,9 +1436,9 @@
result = cm8.getRGB(pixBuf[i]);
} else {
result = 0xFF000000 |
- (pixBuf[i * 4 + 1] & 0xFF) << 16 |
- (pixBuf[i * 4 + 2] & 0xFF) << 8 |
- (pixBuf[i * 4 + 3] & 0xFF);
+ (pixBuf[i * 4 + 2] & 0xFF) << 16 |
+ (pixBuf[i * 4 + 1] & 0xFF) << 8 |
+ (pixBuf[i * 4 + 0] & 0xFF);
}
} else {
result = 0; // Transparent pixel
diff -Naur vnc_javasrc.orig/VncViewer.java vnc_javasrc/VncViewer.java
--- vnc_javasrc.orig/VncViewer.java 2004-03-04 08:34:25.000000000 -0500
+++ vnc_javasrc/VncViewer.java 2010-03-27 17:57:04.000000000 -0400
@@ -29,6 +29,7 @@

@ -1685,7 +1685,7 @@ diff -Naur JavaViewer.orig/OptionsFrame.java JavaViewer/OptionsFrame.java
choices[shareDesktopIndex].select("Yes");
diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
--- JavaViewer.orig/RfbProto.java 2006-05-24 15:14:40.000000000 -0400
+++ JavaViewer/RfbProto.java 2010-03-27 17:59:56.000000000 -0400
+++ JavaViewer/RfbProto.java 2010-11-30 22:13:58.000000000 -0500
@@ -31,6 +31,7 @@
import java.net.Socket;
import java.util.*;
@ -2662,7 +2662,45 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
os.write(b);
// }
@@ -1610,6 +1971,21 @@
@@ -1506,6 +1867,37 @@
final static int META_MASK = InputEvent.META_MASK;
final static int ALT_MASK = InputEvent.ALT_MASK;
+ void writeWheelEvent(MouseWheelEvent evt) throws IOException {
+ eventBufLen = 0;
+
+ int x = evt.getX();
+ int y = evt.getY();
+
+ if (x < 0) x = 0;
+ if (y < 0) y = 0;
+
+ int ptrmask;
+
+ int clicks = evt.getWheelRotation();
+ System.out.println("writeWheelEvent: clicks: " + clicks);
+ if (clicks > 0) {
+ ptrmask = 16;
+ } else if (clicks < 0) {
+ ptrmask = 8;
+ } else {
+ return;
+ }
+
+ eventBuf[eventBufLen++] = (byte) PointerEvent;
+ eventBuf[eventBufLen++] = (byte) ptrmask;
+ eventBuf[eventBufLen++] = (byte) ((x >> 8) & 0xff);
+ eventBuf[eventBufLen++] = (byte) (x & 0xff);
+ eventBuf[eventBufLen++] = (byte) ((y >> 8) & 0xff);
+ eventBuf[eventBufLen++] = (byte) (y & 0xff);
+
+ os.write(eventBuf, 0, eventBufLen);
+ }
+
//
// Write a pointer event message. We may need to send modifier key events
// around it to set the correct modifier state.
@@ -1610,6 +2002,21 @@
boolean down = (evt.getID() == KeyEvent.KEY_PRESSED);
@ -2684,7 +2722,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
int key;
if (evt.isActionKey()) {
@@ -1685,6 +2061,9 @@
@@ -1685,6 +2092,9 @@
default :
return;
}
@ -2694,7 +2732,7 @@ diff -Naur JavaViewer.orig/RfbProto.java JavaViewer/RfbProto.java
} else {
@@ -1794,6 +2173,16 @@
@@ -1794,6 +2204,16 @@
int oldModifiers = 0;
void writeModifierKeyEvents(int newModifiers) {
@ -4784,18 +4822,31 @@ diff -Naur JavaViewer.orig/SSLSocketToMe.java JavaViewer/SSLSocketToMe.java
+}
diff -Naur JavaViewer.orig/VncCanvas.java JavaViewer/VncCanvas.java
--- JavaViewer.orig/VncCanvas.java 2005-11-21 18:50:18.000000000 -0500
+++ JavaViewer/VncCanvas.java 2007-05-31 15:33:20.000000000 -0400
@@ -27,6 +27,9 @@
+++ JavaViewer/VncCanvas.java 2010-11-30 22:57:50.000000000 -0500
@@ -27,6 +27,13 @@
import java.lang.*;
import java.util.zip.*;
+// begin runge/x11vnc
+import java.util.Collections;
+// end runge/x11vnc
+
+// begin runge/x11vnc
+// all the MouseWheel stuff below.
+// end runge/x11vnc
//
// VncCanvas is a subclass of Canvas which draws a VNC desktop on it.
@@ -85,6 +88,22 @@
@@ -34,7 +41,7 @@
class VncCanvas
extends Canvas
- implements KeyListener, MouseListener, MouseMotionListener {
+ implements KeyListener, MouseListener, MouseMotionListener, MouseWheelListener {
VncViewer viewer;
RfbProto rfb;
@@ -85,6 +92,22 @@
cm24 = new DirectColorModel(24, 0xFF0000, 0x00FF00, 0x0000FF);
@ -4818,7 +4869,23 @@ diff -Naur JavaViewer.orig/VncCanvas.java JavaViewer/VncCanvas.java
colors = new Color[256];
// sf@2005 - Now Default
for (int i = 0; i < 256; i++)
@@ -202,6 +221,9 @@
@@ -186,6 +209,7 @@
inputEnabled = true;
addMouseListener(this);
addMouseMotionListener(this);
+ addMouseWheelListener(this);
if (viewer.showControls) {
viewer.buttonPanel.enableRemoteAccessControls(true);
}
@@ -193,6 +217,7 @@
inputEnabled = false;
removeMouseListener(this);
removeMouseMotionListener(this);
+ removeMouseWheelListener(this);
if (viewer.showControls) {
viewer.buttonPanel.enableRemoteAccessControls(false);
}
@@ -202,6 +227,9 @@
public void setPixelFormat() throws IOException {
// sf@2005 - Adding more color modes
@ -4828,7 +4895,7 @@ diff -Naur JavaViewer.orig/VncCanvas.java JavaViewer/VncCanvas.java
if (viewer.options.eightBitColors > 0)
{
viewer.options.oldEightBitColors = viewer.options.eightBitColors;
@@ -237,6 +259,9 @@
@@ -237,6 +265,9 @@
}
else
{
@ -4838,7 +4905,7 @@ diff -Naur JavaViewer.orig/VncCanvas.java JavaViewer/VncCanvas.java
rfb.writeSetPixelFormat(
32,
24,
@@ -376,12 +401,14 @@
@@ -376,12 +407,14 @@
// Start/stop session recording if necessary.
viewer.checkRecordingStatus();
@ -4859,7 +4926,7 @@ diff -Naur JavaViewer.orig/VncCanvas.java JavaViewer/VncCanvas.java
//
// main dispatch loop
@@ -390,6 +417,9 @@
@@ -390,6 +423,9 @@
while (true) {
// Read message type from the server.
int msgType = rfb.readServerMessageType();
@ -4869,7 +4936,37 @@ diff -Naur JavaViewer.orig/VncCanvas.java JavaViewer/VncCanvas.java
// Process the message depending on its type.
switch (msgType) {
@@ -1532,9 +1562,14 @@
@@ -1332,6 +1368,9 @@
public void mouseDragged(MouseEvent evt) {
processLocalMouseEvent(evt, true);
}
+ public void mouseWheelMoved(MouseWheelEvent evt) {
+ processLocalMouseWheelEvent(evt);
+ }
public void processLocalKeyEvent(KeyEvent evt) {
if (viewer.rfb != null && rfb.inNormalProtocol) {
@@ -1367,6 +1406,19 @@
evt.consume();
}
+ public void processLocalMouseWheelEvent(MouseWheelEvent evt) {
+ if (viewer.rfb != null && rfb.inNormalProtocol) {
+ synchronized(rfb) {
+ try {
+ rfb.writeWheelEvent(evt);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ rfb.notify();
+ }
+ }
+ }
+
public void processLocalMouseEvent(MouseEvent evt, boolean moved) {
if (viewer.rfb != null && rfb.inNormalProtocol) {
if (moved) {
@@ -1532,9 +1584,14 @@
else
{
result =
@ -4887,7 +4984,7 @@ diff -Naur JavaViewer.orig/VncCanvas.java JavaViewer/VncCanvas.java
}
} else {
result = 0; // Transparent pixel
@@ -1565,9 +1600,14 @@
@@ -1565,9 +1622,14 @@
else
{
result =

@ -19,7 +19,7 @@ sed -e "s/LibVNCServer, [^,)]*\([(,]\)*/x11vnc, $VERSION\1/g" \
mv Makefile.am Makefile.am.LibVNCServer
echo "EXTRA_DIST=tightvnc-1.3dev5-vncviewer-alpha-cursor.patch README.LibVNCServer" > Makefile.am
echo "EXTRA_DIST=tightvnc-1.3dev5-vncviewer-alpha-cursor.patch RELEASE-NOTES README.LibVNCServer" > Makefile.am
echo "" >> Makefile.am
echo "if HAVE_SYSTEM_LIBVNCSERVER" >> Makefile.am
echo "SUBDIRS=x11vnc classes" >> Makefile.am
@ -41,6 +41,7 @@ sed -e "s/^SUBDIRS.*$/#SUBDIRS=libvncserver libvncclient x11vnc classes/" \
mv README README.LibVNCServer
cp x11vnc/README ./README
cp x11vnc/RELEASE-NOTES ./RELEASE-NOTES
cat LibVNCServer.spec.in | \
sed -e "s/Johannes.Schindelin@gmx.de/runge@karlrunge.com/gi" \
@ -134,4 +135,5 @@ make x11vnc-${VERSION}.tar.gz
for f in configure.ac Makefile.am x11vnc/Makefile.am libvncserver/Makefile.am libvncclient/Makefile.am classes/Makefile.am classes/ssl/Makefile.am acinclude.m4 README; do
mv -f $f.LibVNCServer $f
done
rm -f ./RELEASE-NOTES

@ -720,7 +720,7 @@ static int check_depth_win(Window win, Window top, XWindowAttributes *attr) {
if (store_it) {
int i, j = -1, none = -1, nomap = -1;
int new = 0;
int newc = 0;
if (attr->map_state == IsViewable) {
/* count the visible ones: */
multivis_count++;
@ -754,7 +754,7 @@ if (db24 > 1) fprintf(stderr, "multivis: 0x%lx %d\n", win, attr->depth);
} else if (none >= 0) {
/* put it in the first None slot */
j = none;
new = 1;
newc = 1;
} else if (nomap >=0) {
/* put it in the first unmapped slot */
j = nomap;
@ -791,8 +791,8 @@ if (db24 > 1) fprintf(stderr, "multivis: STORE 0x%lx j: %3d ms: %d dep=%d\n", wi
windows_8bpp[j].x = x;
windows_8bpp[j].y = y;
if (new || now_vis) {
if (db24) fprintf(stderr, "new/now_vis: 0x%lx %d/%d\n", win, new, now_vis);
if (newc || now_vis) {
if (db24) fprintf(stderr, "new/now_vis: 0x%lx %d/%d\n", win, newc, now_vis);
/* mark it immediately if a new one: */
X_UNLOCK; /* dont forget the giant lock */
mark_rect_as_modified(x, y, x + attr->width,

@ -1,3 +1,19 @@
2010-12-21 Karl Runge <runge@karlrunge.com>
* x11vnc: Add RELEASE-NOTES. Call shutdown_uinput() when exiting.
Free some minor memory. Do not use GetMainDevice() on macosx.
Add utility scripts qt_tslib_inject.pl and uinput.pl. Option
-ungrabboth (not useful.) X11VNC_SB_FACTOR -sb user tweak.
X11VNC_REFLECT_{bitsPerSample,samplesPerPixel,bytesPerPixel}
for -reflect vncclient. Fix minor fd leaks. For -create mode
preserve LC_ALL; FIND_DISPLAY_NO_VT_FIND, FIND_DISPLAY_NO_LSOF,
and X11VNC_CREATE_LC_ALL_C_OK. Speed up -find and -create scripts
for large installations. Enable direct event input modes to
bypass uinput. TSLIB support for uinput touchscreens. Handle
pressure events on touchscreens. User can set X11VNC_UINPUT_BUS
and X11VNC_UINPUT_VERSION. Allow Tab switch in -create login:
prompt. Fix bug in setting bpp for -rawfb. Java viewers now
handle mousewheel events. No vars named new.
2010-09-10 Karl Runge <runge@karlrunge.com>
* x11vnc: update classes/ssl jars, patches, and script.
update prepare_x11vnc_dist.sh to 0.9.13. Makefile.am no top_srcdir

@ -16,7 +16,7 @@ desktopdir = $(datadir)/applications
desktop_DATA = x11vnc.desktop
man_MANS=x11vnc.1
EXTRA_DIST=ChangeLog README tkx11vnc $(man_MANS) $(desktop_DATA)
EXTRA_DIST=ChangeLog README RELEASE-NOTES tkx11vnc $(man_MANS) $(desktop_DATA)
if CYGIPC
LD_CYGIPC=-lcygipc

@ -2,7 +2,7 @@
Copyright (C) 2002-2010 Karl J. Runge <runge@karlrunge.com>
All rights reserved.
x11vnc README file Date: Fri Sep 10 12:29:36 EDT 2010
x11vnc README file Date: Tue Dec 21 11:45:35 EST 2010
The following information is taken from these URLs:
@ -241,7 +241,7 @@ to: http://www.karlrunge.com/x11vnc/faq.html#faq-singleclick
* Have x11vnc (0.9.3 or later) available to run on the remote host
(i.e. in $PATH.)
* Download and unpack a SSVNC bundle (1.0.19 or later, e.g.
ssvnc_no_windows-1.0.23.tar.gz) on the Viewer-side machine.
ssvnc_no_windows-1.0.28.tar.gz) on the Viewer-side machine.
* Start the SSVNC Terminal Services mode GUI: ./ssvnc/bin/tsvnc
* Enter your remote username@hostname (e.g. fred@far-away.east) in
the "VNC Terminal Server" entry.
@ -909,10 +909,43 @@ make
Here are some features that will appear in the 0.9.13 release:
* Coming Soon!
Here are some features that appeared in the 0.9.12 release:
* Improved support for non-X11 touchscreen devices (e.g. handheld or
cell phone) via Linux uinput input injection. Additional tuning
parameters are added. TSLIB touchscreen calibration is supported.
Tested on Qtmoko Neo Freerunner. A tool, misc/uinput.pl, is
provided to diagnose uinput behavior on new devices. The env.
vars. X11VNC_UINPUT_BUS and X11VNC_UINPUT_VERSION are available if
leaving them unset does not work.
* The Linux uinput non-X11 input injection can now be bypassed:
events can be directly written to the /dev/input/event devices
specified by the user (direct_abs=..., etc.) A -pipeinput input
injection helper script, misc/qt_tslib_inject.pl is provided as a
tweakable non-builtin direct input injection method.
* The list of new uinput parameters for the above two features is:
pressure, tslib_cal, touch_always, dragskip, btn_touch;
direct_rel, direct_abs, direct_btn, direct_key.
* The included SSL enabled Java VNC Viewers now handle Mouse Wheel
events.
* miscellaneous new features and changes: In -reflect mode, the
libvncclient connection can now have the pixel format modified via
the environment variables X11VNC_REFLECT_bitsPerSample,
X11VNC_REFLECT_samplesPerPixel, and X11VNC_REFLECT_bytesPerPixel
* In -create mode the following environment variables are added to
fine tune the behavior: FIND_DISPLAY_NO_LSOF: do not use lsof(1)
to try to determine the Linux VT, FIND_DISPLAY_NO_VT_FIND: do not
try to determine the Linux VT at all, X11VNC_CREATE_LC_ALL_C_OK:
do not bother undoing the setting LC_ALL=C that the create_display
script sets. The performance of the -create script has been
improved for large installations (100's of user sessions on one
machine.)
* In -unixpw mode, one can now Tab from login: to Password.
* An environment variable, X11VNC_SB_FACTOR, allows one to scale the
-sb screenblank sleep time from the default 2 secs.
* Documented that -grabkbd is no longer working with some/most
window managers (it can prevent resizing and menu posting.)
Here are some features that appeared in the 0.9.12 release (Sep/2010):
* One can now specify the maximum number of displays that can be
created in -create mode via the env. var.
X11VNC_CREATE_MAX_DISPLAYS
@ -922,7 +955,7 @@ make
killed by the display manager.
* A compile time bug is fixed so that configuring using
--with-system-libvncserver pointing to LibVNCServer 0.9.7 works
again. A bug from forced used of Xdefs.h is worked around.
again. A bug from forced use of Xdefs.h is worked around.
Here are some features that appeared in the 0.9.11 release (Aug/2010):
@ -2028,56 +2061,63 @@ http://www.karlrunge.com/x11vnc/faq.html:
Q-114: Can I export via VNC a Webcam or TV tuner framebuffer using
x11vnc?
Q-115: Can I connect via VNC to a Qt-embedded/Qtopia application
running on my handheld or PC using the Linux console framebuffer (i.e.
not X11)?
Q-115: Can I connect via VNC to a Qt-embedded/Qt-enhanced/Qtopia
application running on my handheld, cell phone, or PC using the Linux
console framebuffer (i.e. not X11)?
Q-116: Now that non-X11 devices can be exported via VNC using x11vnc,
Q-116: How do I inject touch screen input into an
Qt-embedded/Qt-enhanced/Qtopia cell phone such as openmoko/qtmoko Neo
Freerunner?
Q-117: Now that non-X11 devices can be exported via VNC using x11vnc,
can I build it with no dependencies on X11 header files and libraries?
Q-117: Does x11vnc support Mac OS X Aqua/Quartz displays natively
Q-118: How do I cross compile x11vnc for a different architecture than
my Linux i386 or amd64 PC?
Q-119: Does x11vnc support Mac OS X Aqua/Quartz displays natively
(i.e. no X11 involved)?
Q-118: Can x11vnc be used as a VNC reflector/repeater to improve
Q-120: Can x11vnc be used as a VNC reflector/repeater to improve
performance for the case of a large number of simultaneous VNC viewers
(e.g. classroom broadcasting or a large demo)?
Q-119: Can x11vnc be used during a Linux, Solaris, etc. system
Q-121: Can x11vnc be used during a Linux, Solaris, etc. system
Installation so the Installation can be done remotely?
[Misc: Clipboard, File Transfer/Sharing, Printing, Sound, Beeps,
Thanks, etc.]
Q-120: Does the Clipboard/Selection get transferred between the
Q-122: Does the Clipboard/Selection get transferred between the
vncviewer and the X display?
Q-121: Can I use x11vnc to record a Shock Wave Flash (or other format)
Q-123: Can I use x11vnc to record a Shock Wave Flash (or other format)
video of my desktop, e.g. to record a tutorial or demo?
Q-122: Can I transfer files back and forth with x11vnc?
Q-124: Can I transfer files back and forth with x11vnc?
Q-123: Which UltraVNC extensions are supported?
Q-125: Which UltraVNC extensions are supported?
Q-124: Can x11vnc emulate UltraVNC's Single Click helpdesk mode for
Q-126: Can x11vnc emulate UltraVNC's Single Click helpdesk mode for
Unix? I.e. something very simple for a naive user to initiate a
reverse vnc connection from their Unix desktop to a helpdesk
operator's VNC Viewer.
Q-125: Can I (temporarily) mount my local (viewer-side) Windows/Samba
Q-127: Can I (temporarily) mount my local (viewer-side) Windows/Samba
File share on the machine where x11vnc is running?
Q-126: Can I redirect CUPS print jobs from the remote desktop where
Q-128: Can I redirect CUPS print jobs from the remote desktop where
x11vnc is running to a printer on my local (viewer-side) machine?
Q-127: How can I hear the sound (audio) from the remote applications
Q-129: How can I hear the sound (audio) from the remote applications
on the desktop I am viewing via x11vnc?
Q-128: Why don't I hear the "Beeps" in my X session (e.g. when typing
Q-130: Why don't I hear the "Beeps" in my X session (e.g. when typing
tput bel in an xterm)?
Q-129: Does x11vnc work with IPv6?
Q-131: Does x11vnc work with IPv6?
Q-130: Thanks for your program or for your help! Can I make a
Q-132: Thanks for your program or for your help! Can I make a
donation?
_________________________________________________________________
@ -7884,9 +7924,9 @@ minal #2)
x11vnc.)
Q-115: Can I connect via VNC to a Qt-embedded/Qtopia application
running on my handheld or PC using the Linux console framebuffer (i.e.
not X11)?
Q-115: Can I connect via VNC to a Qt-embedded/Qt-enhanced/Qtopia
application running on my handheld, cell phone, or PC using the Linux
console framebuffer (i.e. not X11)?
Yes, the basic method for this is the -rawfb scheme where the Linux
console framebuffer (usually /dev/fb0) is polled and the uinput driver
@ -7945,10 +7985,50 @@ minal #2)
Update: We are finding some setups like Qtopia on the IPAQ do not
allow mouse input via uinput. Please help us debug this problem by
trying x11vnc on your device and letting us know what does and does
not work.
Q-116: Now that non-X11 devices can be exported via VNC using x11vnc,
not work. See the next FAQ for a possible workaround for touchscreens.
Q-116: How do I inject touch screen input into an
Qt-embedded/Qt-enhanced/Qtopia cell phone such as openmoko/qtmoko Neo
Freerunner?
The qtmoko project does not use X11 for the graphical display.
Unfortunately the Linux uinput method described in the previous FAQ
does not work because Qt is using TSLIB (touch screen library) to
process the input and it only reads from one device (often
/dev/input/event1) and not from the new UINPUT device that x11vnc
creates (under -pipeinput UINPUT)
So something else needs to be done. It was discovered that by simply
writing the touchscreen events directly to /dev/input/event1 then
input can be injected into the system. There is no x11vnc builtin mode
for this yet (until we understand it better), but there is a working
script provided in x11vnc/misc/qt_tslib_inject.pl. So one could use it
this way for example:
x11vnc ... -rawfb console -pipeinput path/to/qt_tslib_inject.pl -env INJECT_O
PTIONS=clickonly,cal=/etc/pointercal
Read the script for how to enable other options and what the above
options mean (e.g. /etc/pointercal contains TSLIB's calibration
parameters and are necessary to achieve accurate pointing.)
The x11vnc/misc/qt_tslib_inject.pl script can potentially be modified
to handle other devices where the uinput method fails. It could also
be modified to create 'hot keys', etc.
Please let us know how things go if you try this out; there is much to
learn about synthetic input injection in handhelds and cell phones. As
we learn more we can develop a builtin x11vnc mode for this sort of
injection.
Update Dec/2010: There is experimental built-in UINPUT support in the
x11vnc development tarball for qtmoko with touchpad managed by tslib.
See -pipeinput UINPUT for more info. Here is an example:
x11vnc -rawfb console -pipeinput UINPUT:touch,tslib_cal=/etc/pointercal,dire
ct_abs=/dev/input/event1,nouinput,dragskip=3
Q-117: Now that non-X11 devices can be exported via VNC using x11vnc,
can I build it with no dependencies on X11 header files and libraries?
Yes, as of Jul/2006 x11vnc enables building for -rawfb only support.
@ -7962,7 +8042,40 @@ minal #2)
know what you did.
Q-117: Does x11vnc support Mac OS X Aqua/Quartz displays natively
Q-118: How do I cross compile x11vnc for a different architecture than
my Linux i386 or amd64 PC?
You will need a cross-compiling toolchain. Perhaps your distro
provides these or you can find a HOWTO for your distro. We found a
nice one at qtmoko.org for building armel binaries on Debian Linux
i386 machines. It includes most of the libraries that x11vnc needs. We
use that example here.
We ran this script to set PATH, configure, and build:
#!/bin/sh
# toolchain from: qtmoko-debian-toolchain-armv4t-eabi.tar.gz
export PATH=/opt/toolchains/arm920t-eabi/bin:$PATH
env CC=arm-linux-gcc ./configure --host=arm-linux --without-avahi
make
arm-linux-strip ./x11vnc/x11vnc
ls -l ./x11vnc/x11vnc
Note we had to include --without-avahi due to lack of
libavahi-client.so.3 supplied by the toolchain we used. One would need
to add it if it was desired on the target machine. We also stripped
the binary to make it smaller.
For an embedded system one may also want to add --without-x if the
embedded system does not use X11 and the -rawfb mechanism must be
used.
Q-119: Does x11vnc support Mac OS X Aqua/Quartz displays natively
(i.e. no X11 involved)?
Yes, since Nov/2006 in the development tree (x11vnc-0.8.4 tarball)
@ -8086,7 +8199,7 @@ ONLY do that for Mac OS X 10.5.x and NOT for 10.6.x (which doesn't
need it anyway).
Q-118: Can x11vnc be used as a VNC reflector/repeater to improve
Q-120: Can x11vnc be used as a VNC reflector/repeater to improve
performance for the case of a large number of simultaneous VNC viewers
(e.g. classroom broadcasting or a large demo)?
@ -8195,7 +8308,7 @@ need it anyway).
us know what you did. A really nice thing would be some sort of
auto-discovery of your repeater, etc...
Q-119: Can x11vnc be used during a Linux, Solaris, etc. system
Q-121: Can x11vnc be used during a Linux, Solaris, etc. system
Installation so the Installation can be done remotely?
This can be done, but it doesn't always work because it depends on how
@ -8288,7 +8401,7 @@ need it anyway).
[Misc: Clipboard, File Transfer/Sharing, Printing, Sound, Beeps,
Thanks, etc.]
Q-120: Does the Clipboard/Selection get transferred between the
Q-122: Does the Clipboard/Selection get transferred between the
vncviewer and the X display?
As of Jan/2004 x11vnc supports the "CutText" part of the RFB (aka VNC)
@ -8342,7 +8455,7 @@ need it anyway).
cutbuffers.
Q-121: Can I use x11vnc to record a Shock Wave Flash (or other format)
Q-123: Can I use x11vnc to record a Shock Wave Flash (or other format)
video of my desktop, e.g. to record a tutorial or demo?
Yes, it is possible with a number of tools that record VNC and
@ -8354,7 +8467,7 @@ need it anyway).
parameters should be applied to x11vnc to speed up its polling for
this sort of application, e.g. "-wait 10 -defer 10".
Q-122: Can I transfer files back and forth with x11vnc?
Q-124: Can I transfer files back and forth with x11vnc?
As of Oct/2005 and May/2006 x11vnc enables, respectively, the TightVNC
and UltraVNC file transfer implementations that were added to
@ -8402,7 +8515,7 @@ need it anyway).
control you will probably be foiled by the "-rfbversion 3.6" issue.
Q-123: Which UltraVNC extensions are supported?
Q-125: Which UltraVNC extensions are supported?
Some of them are supported. To get UltraVNC Viewers to attempt to use
these extensions you will need to supply this option to x11vnc:
@ -8432,7 +8545,7 @@ need it anyway).
ultravnc_repeater.pl
Q-124: Can x11vnc emulate UltraVNC's Single Click helpdesk mode for
Q-126: Can x11vnc emulate UltraVNC's Single Click helpdesk mode for
Unix? I.e. something very simple for a naive user to initiate a
reverse vnc connection from their Unix desktop to a helpdesk
operator's VNC Viewer.
@ -8670,7 +8783,7 @@ connect = localhost:5501
You will find the details here.
Q-125: Can I (temporarily) mount my local (viewer-side) Windows/Samba
Q-127: Can I (temporarily) mount my local (viewer-side) Windows/Samba
File share on the machine where x11vnc is running?
You will have to use an external network redirection for this.
@ -8720,7 +8833,7 @@ d,ip=127.0.0.1,port=1139
Sep 2006 it is there for testing.)
Q-126: Can I redirect CUPS print jobs from the remote desktop where
Q-128: Can I redirect CUPS print jobs from the remote desktop where
x11vnc is running to a printer on my local (viewer-side) machine?
You will have to use an external network redirection for this.
@ -8812,7 +8925,7 @@ d,ip=127.0.0.1,port=1139
Sep 2006 it is there for testing.)
Q-127: How can I hear the sound (audio) from the remote applications
Q-129: How can I hear the sound (audio) from the remote applications
on the desktop I am viewing via x11vnc?
You will have to use an external network audio mechanism for this.
@ -8913,7 +9026,7 @@ or:
provide (as of Sep/2006 it is there for testing.)
Q-128: Why don't I hear the "Beeps" in my X session (e.g. when typing
Q-130: Why don't I hear the "Beeps" in my X session (e.g. when typing
tput bel in an xterm)?
As of Dec/2003 "Beep" XBell events are tracked by default. The X
@ -8926,7 +9039,7 @@ or:
redirector such as esd.
Q-129: Does x11vnc work with IPv6?
Q-131: Does x11vnc work with IPv6?
Update: as of Apr/2010 in the 0.9.10 x11vnc development tarball, there
is now built-in support for IPv6 (128 bit internet addresses.) See the
@ -9025,7 +9138,7 @@ or:
Contributions:
Q-130: Thanks for your program or for your help! Can I make a
Q-132: Thanks for your program or for your help! Can I make a
donation?
Please do (any amount is appreciated; very few have donated) and thank
@ -12172,7 +12285,7 @@ x11vnc: a VNC server for real X displays
Here are all of x11vnc command line options:
% x11vnc -opts (see below for -help long descriptions)
x11vnc: allow VNC connections to real X11 displays. 0.9.13 lastmod: 2010-09-10
x11vnc: allow VNC connections to real X11 displays. 0.9.13 lastmod: 2010-12-20
x11vnc options:
-display disp -auth file -N
@ -12193,83 +12306,83 @@ x11vnc options:
-vncconnect -novncconnect -allow host1[,host2..]
-localhost -listen6 str -nolookup
-input string -grabkbd -grabptr
-grabalways -viewpasswd string -passwdfile filename
-showrfbauth filename -unixpw [list] -unixpw_nis [list]
-unixpw_cmd cmd -find -finddpy
-listdpy -findauth [disp] -create
-xdummy -xvnc -xvnc_redirect
-xdummy_xvfb -create_xsrv str -svc
-svc_xdummy -svc_xvnc -svc_xdummy_xvfb
-xdmsvc -sshxdmsvc -unixpw_system_greeter
-redirect port -display WAIT:... -vencrypt mode
-anontls mode -sslonly -dhparams file
-nossl -ssl [pem] -ssltimeout n
-sslnofail -ssldir dir -sslverify path
-sslCRL path -sslGenCA [dir] -sslGenCert type name
-sslEncKey pem -sslCertInfo pem -sslDelCert pem
-sslScripts -stunnel [pem] -stunnel3 [pem]
-enc cipher:keyfile -https [port] -httpsredir [port]
-http_oneport -ssh user@host:disp -usepw
-storepasswd pass file -nopw -accept string
-afteraccept string -gone string -users list
-noshm -flipbyteorder -onetile
-solid [color] -blackout string -xinerama
-noxinerama -xtrap -xrandr [mode]
-rotate string -padgeom WxH -o logfile
-flag file -rmflag file -rc filename
-norc -env VAR=VALUE -prog /path/to/x11vnc
-h, -help -?, -opts -V, -version
-license -dbg -q, -quiet
-v, -verbose -bg -modtweak
-nomodtweak -xkb -noxkb
-capslock -skip_lockkeys -noskip_lockkeys
-skip_keycodes string -sloppy_keys -skip_dups
-noskip_dups -add_keysyms -noadd_keysyms
-clear_mods -clear_keys -clear_all
-remap string -norepeat -repeat
-nofb -nobell -nosel
-noprimary -nosetprimary -noclipboard
-nosetclipboard -seldir string -cursor [mode]
-nocursor -cursor_drag -arrow n
-noxfixes -alphacut n -alphafrac fraction
-alpharemove -noalphablend -nocursorshape
-cursorpos -nocursorpos -xwarppointer
-noxwarppointer -always_inject -buttonmap string
-nodragging -ncache n -ncache_cr
-ncache_no_moveraise -ncache_no_dtchange -ncache_no_rootpixmap
-ncache_keep_anims -ncache_old_wm -ncache_pad n
-debug_ncache -wireframe [str] -nowireframe
-nowireframelocal -wirecopyrect mode -nowirecopyrect
-debug_wireframe -scrollcopyrect mode -noscrollcopyrect
-scr_area n -scr_skip list -scr_inc list
-scr_keys list -scr_term list -scr_keyrepeat lo-hi
-scr_parms string -fixscreen string -debug_scroll
-noxrecord -grab_buster -nograb_buster
-debug_grabs -debug_sel -pointer_mode n
-input_skip n -allinput -input_eagerly
-speeds rd,bw,lat -wmdt string -debug_pointer
-debug_keyboard -defer time -wait time
-extra_fbur n -wait_ui factor -setdefer n
-nowait_bog -slow_fb time -xrefresh time
-nap -nonap -sb time
-readtimeout n -ping n -nofbpm
-fbpm -nodpms -dpms
-forcedpms -clientdpms -noserverdpms
-noultraext -chatwindow -noxdamage
-xd_area A -xd_mem f -sigpipe string
-threads -nothreads -fs f
-gaps n -grow n -fuzz n
-debug_tiles -snapfb -rawfb string
-freqtab file -pipeinput cmd -macnodim
-macnosleep -macnosaver -macnowait
-macwheel n -macnoswap -macnoresize
-maciconanim n -macmenu -macuskbd
-gui [gui-opts] -remote command -query variable
-QD variable -sync -query_retries str
-remote_prefix str -noremote -yesremote
-unsafe -safer -privremote
-nocmds -allowedcmds list -deny_all
-ungrabboth -grabalways -viewpasswd string
-passwdfile filename -showrfbauth filename -unixpw [list]
-unixpw_nis [list] -unixpw_cmd cmd -find
-finddpy -listdpy -findauth [disp]
-create -xdummy -xvnc
-xvnc_redirect -xdummy_xvfb -create_xsrv str
-svc -svc_xdummy -svc_xvnc
-svc_xdummy_xvfb -xdmsvc -sshxdmsvc
-unixpw_system_greeter -redirect port -display WAIT:...
-vencrypt mode -anontls mode -sslonly
-dhparams file -nossl -ssl [pem]
-ssltimeout n -sslnofail -ssldir dir
-sslverify path -sslCRL path -sslGenCA [dir]
-sslGenCert type name -sslEncKey pem -sslCertInfo pem
-sslDelCert pem -sslScripts -stunnel [pem]
-stunnel3 [pem] -enc cipher:keyfile -https [port]
-httpsredir [port] -http_oneport -ssh user@host:disp
-usepw -storepasswd pass file -nopw
-accept string -afteraccept string -gone string
-users list -noshm -flipbyteorder
-onetile -solid [color] -blackout string
-xinerama -noxinerama -xtrap
-xrandr [mode] -rotate string -padgeom WxH
-o logfile -flag file -rmflag file
-rc filename -norc -env VAR=VALUE
-prog /path/to/x11vnc -h, -help -?, -opts
-V, -version -license -dbg
-q, -quiet -v, -verbose -bg
-modtweak -nomodtweak -xkb
-noxkb -capslock -skip_lockkeys
-noskip_lockkeys -skip_keycodes string -sloppy_keys
-skip_dups -noskip_dups -add_keysyms
-noadd_keysyms -clear_mods -clear_keys
-clear_all -remap string -norepeat
-repeat -nofb -nobell
-nosel -noprimary -nosetprimary
-noclipboard -nosetclipboard -seldir string
-cursor [mode] -nocursor -cursor_drag
-arrow n -noxfixes -alphacut n
-alphafrac fraction -alpharemove -noalphablend
-nocursorshape -cursorpos -nocursorpos
-xwarppointer -noxwarppointer -always_inject
-buttonmap string -nodragging -ncache n
-ncache_cr -ncache_no_moveraise -ncache_no_dtchange
-ncache_no_rootpixmap -ncache_keep_anims -ncache_old_wm
-ncache_pad n -debug_ncache -wireframe [str]
-nowireframe -nowireframelocal -wirecopyrect mode
-nowirecopyrect -debug_wireframe -scrollcopyrect mode
-noscrollcopyrect -scr_area n -scr_skip list
-scr_inc list -scr_keys list -scr_term list
-scr_keyrepeat lo-hi -scr_parms string -fixscreen string
-debug_scroll -noxrecord -grab_buster
-nograb_buster -debug_grabs -debug_sel
-pointer_mode n -input_skip n -allinput
-input_eagerly -speeds rd,bw,lat -wmdt string
-debug_pointer -debug_keyboard -defer time
-wait time -extra_fbur n -wait_ui factor
-setdefer n -nowait_bog -slow_fb time
-xrefresh time -nap -nonap
-sb time -readtimeout n -ping n
-nofbpm -fbpm -nodpms
-dpms -forcedpms -clientdpms
-noserverdpms -noultraext -chatwindow
-noxdamage -xd_area A -xd_mem f
-sigpipe string -threads -nothreads
-fs f -gaps n -grow n
-fuzz n -debug_tiles -snapfb
-rawfb string -freqtab file -pipeinput cmd
-macnodim -macnosleep -macnosaver
-macnowait -macwheel n -macnoswap
-macnoresize -maciconanim n -macmenu
-macuskbd -gui [gui-opts] -remote command
-query variable -QD variable -sync
-query_retries str -remote_prefix str -noremote
-yesremote -unsafe -safer
-privremote -nocmds -allowedcmds list
-deny_all
LibVNCServer options:
-rfbport port TCP port for RFB protocol
@ -12303,7 +12416,7 @@ libvncserver-tight-extension options:
% x11vnc -help
x11vnc: allow VNC connections to real X11 displays. 0.9.13 lastmod: 2010-09-10
x11vnc: allow VNC connections to real X11 displays. 0.9.13 lastmod: 2010-12-20
(type "x11vnc -opts" to just list the options.)
@ -13085,6 +13198,12 @@ Options:
Some degree of cooperation from the person at the
display is assumed. This is intended for remote
help-desk or educational usage modes.
Note: on some recent (12/2010) X servers and/or
desktops, -grabkbd no longer works: it prevents the
window manager from resizing windows and similar things.
Try -ungrabboth below (might not work.)
-grabptr As -grabkbd, but for the mouse pointer using
XGrabPointer(3X11). Unfortunately due to the way the X
server works, the mouse can still be moved around by the
@ -13094,6 +13213,11 @@ Options:
act on the local user's input. Again, some degree of
cooperation from the person at the display is assumed.
-ungrabboth Whenever there is any input (either keyboard or
pointer), ungrab *both* the keyboard and the pointer
while injecting the synthetic input. This is to allow
window managers, etc. a chance to grab.
-grabalways Apply both -grabkbd and -grabptr even when no VNC
viewers are connected. If you only want one of them,
use the -R remote control to turn the other back on,
@ -13639,6 +13763,15 @@ Options:
xauth extract - $DISPLAY"
NOTE: As specified in the previous paragraph, you can
supply your own WAIT:cmd=... program or script, BUT
there are two very useful *BUILT-IN* ones: FINDDISPLAY
(alias -find above) and FINDCREATEDISPLAY (alias -create
above.) Most people use these instead of creating
their own script. Read the following (especially the
BUILT-IN modes sections) to see how to configure these
two useful builtin -display WAIT: modes.
In the case of -unixpw (and -unixpw_nis only if x11vnc
is running as root), then the cmd= command is run
as the user who just authenticated via the login and
@ -13670,6 +13803,11 @@ Options:
your long "login:" line press the Up arrow once
(before typing anything else).
Most of these colon options only apply to the builtin
FINDDISPLAY and FINDCREATEDISPLAY modes, but note
that they are passed to the extrenal command in the
environment as well and so could be used.
In the login panel, press F1 to get a list of the
available options that you can add after the username.
@ -13703,23 +13841,19 @@ Options:
and the user put "geom=1600x1200" in his
~/.x11vnc_create file.
To troubleshoot the FINDCREATEDISPLAY mechanism,
set the following env. var. to an output log file,
e.g -env CREATE_DISPLAY_OUTPUT=/tmp/mydebug.txt
To disable the option setting set the environment
variable X11VNC_NO_UNIXPW_OPTS=1 before starting x11vnc.
To set any other options, the user can use the gui
(x11vnc -gui connect) or the remote control method
(x11vnc -R opt:val) during his VNC session.
The combination of -display WAIT:cmd=... and -unixpw
allows automatic pairing of an unix authenticated VNC
user with his desktop. This could be very useful on
SunRays and also any system where multiple users share
a given machine. The user does not need to remember
special ports or passwords set up for his desktop
and VNC.
So we see the combination of -display WAIT:cmd=... and
-unixpw allows automatic pairing of an unix
authenticated VNC user with his desktop. This could
be very useful on SunRays and also any system where
multiple users share a given machine. The user does
not need to remember special ports or passwords set up
for his desktop and VNC.
A nice way to use WAIT:cmd=... is out of inetd(8)
(it automatically forks a new x11vnc for each user).
@ -13731,13 +13865,15 @@ Options:
process that will not switch, but it is only encoding
and decoding the encrypted stream at that point.
Automatic Finding of User X Sessions:
BUILT-IN modes:
-- Automatic Finding of User X Sessions --
As a special case, WAIT:cmd=FINDDISPLAY will run a
script that works on most Unixes to determine a user's
DISPLAY variable and xauthority data (see who(1)).
The option "-find" is an alias for this mode.
NOTE: The option "-find" is an alias for this mode.
To have this default script printed to stdout (e.g. for
customization) run with WAIT:cmd=FINDDISPLAY-print To
@ -13781,7 +13917,12 @@ Options:
X11VNC_SKIP_DISPLAY=all then all display finding fails
as if you set X11VNC_FINDDISPLAY_ALWAYS_FAILS=1 (below.)
Automatic Creation of User X Sessions:
On some systems lsof(1) can be very slow. Set the
env. var. FIND_DISPLAY_NO_LSOF=1 to skip using lsof to
try to find the Linux VT the X server is running on.
set FIND_DISPLAY_NO_VT_FIND=1 to avoid looking at all.
-- Automatic Creation of User X Sessions --
An interesting option is WAIT:cmd=FINDCREATEDISPLAY
that is like FINDDISPLAY in that is uses the same method
@ -13790,13 +13931,19 @@ Options:
for the user. This is the only time x11vnc tries to
actually start up an X server.
The option "-create" is an alias for this mode.
NOTE: The option "-create" is an alias for this mode.
It will start looking for an open display number at :20
Override via X11VNC_CREATE_STARTING_DISPLAY_NUMBER=n
By default 80 X displays are allowed (i.e. going to :99)
Override via X11VNC_CREATE_MAX_DISPLAYS=n
For its heuristics, the create display script sets
LC_ALL=C so that command output is uniform. By default
it will try to restore LC_ALL right before starting the
user session. However, if you don't mind it keeping
LC_ALL=C set the env. var.: X11VNC_CREATE_LC_ALL_C_OK=1
By default FINDCREATEDISPLAY will try Xvfb and then
Xdummy:
@ -13823,6 +13970,10 @@ Options:
it to terminate (or kill the X server process if all
else fails).
To troubleshoot the FINDCREATEDISPLAY mechanism,
set the following env. var. to an output log file,
e.g -env CREATE_DISPLAY_OUTPUT=/tmp/mydebug.txt
So this is a somewhat odd mode for x11vnc in that it
will start up and poll virtual X servers! This can
be used from, say, inetd(8) to provide a means of
@ -16302,6 +16453,7 @@ t
-sb time Time in seconds after NO activity (e.g. screen blank)
to really throttle down the screen polls (i.e. sleep
for about 1.5 secs). Use 0 to disable. Default: 60
Set the env. var. X11VNC_SB_FACTOR to scale it.
-readtimeout n Set LibVNCServer rfbMaxClientWait to n seconds. On
slow links that take a long time to paint the first
@ -16749,18 +16901,19 @@ er
using the 'console_guess' string printed at startup,
be sure to indicate the snap: method.
uinput: If the Linux version appears to be 2.6 or
later and the "uinput" module appears to be present
(modprobe uinput), then the uinput method will be used
instead of /dev/ttyN. uinput allows insertion of BOTH
keystrokes and mouse input and so it preferred when
accessing graphical (e.g. QT-embedded) linux console
apps. See -pipeinput UINPUT below for more information
on this mode; you will have to use -pipeinput if you
want to tweak any UINPUT parameters. You may also want
to also use the -nodragging and -cursor none options.
Use "console0", etc or -pipeinput CONSOLE to force
the /dev/ttyN method.
uinput: If the Linux version appears to be 2.6
or later and the "uinput" module appears to be
present (modprobe uinput), then the uinput method
will be used instead of /dev/ttyN. uinput allows
insertion of BOTH keystrokes and mouse input and so it
preferred when accessing graphical (e.g. QT-embedded)
linux console apps. It also provides more accurate
keystroke insertion. See -pipeinput UINPUT below for
more information on this mode; you will have to use
-pipeinput if you want to tweak any UINPUT parameters.
You may also want to also use the -nodragging and
-cursor none options. Use "console0", etc or
-pipeinput CONSOLE to force the /dev/ttyN method.
Note you can change the Linux VT remotely using the
chvt(1) command to make the one you want be the active
@ -16800,7 +16953,11 @@ er
to improve performance in the case of many (e.g. >
10) simultaneous VNC viewers, and you try a divide
and conquer scheme to reduce bandwidth and improve
responsiveness.
responsiveness. (However, another user found this mode
useful to export a demo display through a slow link:
then multiple demo viewers connected to the reflecting
x11vnc on the fast side of the link, and so avoided
all of the demo viewers going through the slow link.)
For example, if there will be 64 simultaneous VNC
viewers this can lead to a lot of redundant VNC traffic
@ -16831,6 +16988,13 @@ er
to "file:path_to_file" to indicate a file containing
the password as its first line.
To set the pixel format that x11vnc requests as a VNC
CLIENT set the env. vars: X11VNC_REFLECT_bitsPerSample
X11VNC_REFLECT_samplesPerPixel, and
X11VNC_REFLECT_bytesPerPixel; the defaults are 8, 3, 4.
2, 3, 1 would give a low color mode. See the function
rfbGetClient() in libvncclient for more info.
The VNC HOST mode implies -shared. Use -noshared as
a subsequent cmdline option to disable sharing.
@ -16893,7 +17057,8 @@ er
The UINPUT mode currently only does US keyboards (a
scan code option may be added), and not all keysyms
are supported.
are supported. But it is probably more accurate than
the "CONSOLE" method.
You may want to use the options -cursor none and
-nodragging in this mode.
@ -16933,16 +17098,6 @@ er
cause jerkiness or unexpected behavior with menus, etc.
Use reset=0 to disable.
If the uinput device has an absolute pointer (as opposed
to a normal mouse that is a relative pointer) you can
specify the option "abs". Note that a touchpad
on a laptop is an absolute device to some degree.
This (usually) avoids all the problems with mouse
acceleration. If x11vnc has trouble deducing the size
of the device, use "abs=WxH". Furthermore, if the
device is a touchscreen (assumed to have an absolute
pointer) use "touch" or "touch=WxH".
If you set the env. var X11VNC_UINPUT_THRESHOLDS then
the thresh=n mode will be enabled. It is currently
not working well. If |dx| <= thresh and |dy| < thresh
@ -16952,8 +17107,70 @@ er
Example:
-pipeinput UINPUT:accel=4.0 -cursor none
You can also set the env. var X11VNC_UINPUT_DEBUG=1 or
higher to get debugging output for UINPUT mode.
If the uinput device has an absolute pointer (as opposed
to a normal mouse that is a relative pointer) you can
specify the option "abs". Note that a touchpad
on a laptop is an absolute device to some degree.
This (usually) avoids all the problems with mouse
acceleration. If x11vnc has trouble deducing the
size of the device, use "abs=WxH". Furthermore,
if the device is a touchscreen (assumed to have an
absolute pointer) use "touch" or "touch=WxH".
For touchscreens, when a mouse button is pressed,
a pressure increase is injected, and when the button
is released a pressure of zero is injected.
If touch has been set, use "touch_always=1" to
indicate whenever the mouse moves with no button
pressed, a touch event of zero pressure should be
sent anyway. Also use "btn_touch=1" to indicate a
BTN_TOUCH keystroke press or release should be sent
instead of a pressure change. Set "dragskip=n" to
skip n dragged mouse touches (with pressure applied)
before injecting one. To indicate the pressure that
should be sent when there is a button click for a
touchscreen device, specify pressure=n, e.g. n=5. The
default is n=1.
If a touch screen is being used ("touch" above)
and it is having its input processed by tslib, you can
specify the tslib calibration file via tslib_cal=<file>.
For example, tslib_cal=/etc/pointercal. To get accurate
or even usable positioning this is required when tslib
is in use.
The Linux uinput mechanism can be bypassed and one can
write input events DIRECTLY to the devices instead.
To do this, specify one or more of the following
for the input classes: direct_rel=<device>
direct_abs=<device> direct_btn=<device> or
direct_key=<device>. The <device> file is usually
something like /dev/input/event1 but you can specify
any device file or pipe. You must specify each one
of the above classes even if they correspond to the
same device file (rel/abs and btn are often the same.)
Look at the file /proc/bus/input/devices to get an idea
what is available and the device filenames. Note:
The /dev/input/mouse* devices do not seem to work,
use the corresponding /dev/input/event* file instead.
Any input class not directly specified as above will be
handled via the uinput mechanism. To disable creating a
uinput device (and thereby discarding unhandled input),
specify "nouinput".
Examples:
-pipeinput UINPUT:direct_abs=/dev/input/event1
this was used on a qtmoko Neo freerunner (armel):
-pipeinput UINPUT:touch,tslib_cal=/etc/pointercal,
direct_abs=/dev/input/event1,nouinput,dragskip=4
(where the long line has been split into two.)
You can set the env. var X11VNC_UINPUT_DEBUG=1 or higher
to get debugging output for UINPUT mode.
-macnodim For the native MacOSX server, disable dimming.
-macnosleep For the native MacOSX server, disable display sleep.

File diff suppressed because it is too large Load Diff

@ -1358,7 +1358,7 @@ static void list_apps(void) {
static int process_control(char *file, int check_clients) {
int i, nnew = 0, seen[CMAX];
char line[1024], *new[CMAX];
char line[1024], *newctl[CMAX];
FILE *f;
f = fopen(file, "r");
@ -1481,7 +1481,7 @@ static int process_control(char *file, int check_clients) {
if (idx >= 0) {
seen[idx] = 1;
} else {
new[nnew++] = strdup(q);
newctl[nnew++] = strdup(q);
}
}
}
@ -1509,8 +1509,8 @@ static int process_control(char *file, int check_clients) {
}
continue;
}
clients[free] = new[i];
client(new[i], 1);
clients[free] = newctl[i];
client(newctl[i], 1);
}
}
return 1;

@ -50,6 +50,7 @@ so, delete this exception statement from your version.
#include "screen.h"
#include "xrecord.h"
#include "xevents.h"
#include "uinput.h"
/*
* Exiting and error handling routines
@ -187,6 +188,8 @@ void clean_up_exit(int ret) {
pipeinput_fh = NULL;
}
shutdown_uinput();
if (! dpy) { /* raw_rb hack */
if (rm_flagfile) {
unlink(rm_flagfile);

@ -81,26 +81,26 @@ static Window tweak_tk_window_id(Window win) {
return None;
#else
char *name = NULL;
Window parent, new;
Window parent, new_win;
if (getenv("NO_TWEAK_TK_WINDOW_ID")) {
return win;
}
/* hack for tk, does not report outermost window */
new = win;
new_win = win;
parent = parent_window(win, &name);
if (parent && name != NULL) {
lowercase(name);
if (strstr(name, "wish") || strstr(name, "x11vnc")) {
new = parent;
new_win = parent;
rfbLog("tray_embed: using parent: %s\n", name);
}
}
if (name != NULL) {
XFree_wr(name);
}
return new;
return new_win;
#endif /* NO_X11 */
}

@ -848,6 +848,12 @@ void print_help(int mode) {
" Some degree of cooperation from the person at the\n"
" display is assumed. This is intended for remote\n"
" help-desk or educational usage modes.\n"
"\n"
" Note: on some recent (12/2010) X servers and/or\n"
" desktops, -grabkbd no longer works: it prevents the\n"
" window manager from resizing windows and similar things.\n"
" Try -ungrabboth below (might not work.)\n"
"\n"
"-grabptr As -grabkbd, but for the mouse pointer using\n"
" XGrabPointer(3X11). Unfortunately due to the way the X\n"
" server works, the mouse can still be moved around by the\n"
@ -857,6 +863,11 @@ void print_help(int mode) {
" act on the local user's input. Again, some degree of\n"
" cooperation from the person at the display is assumed.\n"
"\n"
"-ungrabboth Whenever there is any input (either keyboard or\n"
" pointer), ungrab *both* the keyboard and the pointer\n"
" while injecting the synthetic input. This is to allow\n"
" window managers, etc. a chance to grab.\n"
"\n"
"-grabalways Apply both -grabkbd and -grabptr even when no VNC\n"
" viewers are connected. If you only want one of them,\n"
" use the -R remote control to turn the other back on,\n"
@ -1412,6 +1423,15 @@ void print_help(int mode) {
"\n"
" xauth extract - $DISPLAY\"\n"
"\n"
" NOTE: As specified in the previous paragraph, you can\n"
" supply your own WAIT:cmd=... program or script, BUT\n"
" there are two very useful *BUILT-IN* ones: FINDDISPLAY\n"
" (alias -find above) and FINDCREATEDISPLAY (alias -create\n"
" above.) Most people use these instead of creating\n"
" their own script. Read the following (especially the\n"
" BUILT-IN modes sections) to see how to configure these\n"
" two useful builtin -display WAIT: modes.\n"
"\n"
" In the case of -unixpw (and -unixpw_nis only if x11vnc\n"
" is running as root), then the cmd= command is run\n"
" as the user who just authenticated via the login and\n"
@ -1443,6 +1463,11 @@ void print_help(int mode) {
" your long \"login:\" line press the Up arrow once\n"
" (before typing anything else).\n"
"\n"
" Most of these colon options only apply to the builtin\n"
" FINDDISPLAY and FINDCREATEDISPLAY modes, but note\n"
" that they are passed to the extrenal command in the\n"
" environment as well and so could be used.\n"
"\n"
" In the login panel, press F1 to get a list of the\n"
" available options that you can add after the username.\n"
"\n"
@ -1476,23 +1501,19 @@ void print_help(int mode) {
" and the user put \"geom=1600x1200\" in his\n"
" ~/.x11vnc_create file.\n"
"\n"
" To troubleshoot the FINDCREATEDISPLAY mechanism,\n"
" set the following env. var. to an output log file,\n"
" e.g -env CREATE_DISPLAY_OUTPUT=/tmp/mydebug.txt\n"
"\n"
" To disable the option setting set the environment\n"
" variable X11VNC_NO_UNIXPW_OPTS=1 before starting x11vnc.\n"
" To set any other options, the user can use the gui\n"
" (x11vnc -gui connect) or the remote control method\n"
" (x11vnc -R opt:val) during his VNC session.\n"
"\n"
" The combination of -display WAIT:cmd=... and -unixpw\n"
" allows automatic pairing of an unix authenticated VNC\n"
" user with his desktop. This could be very useful on\n"
" SunRays and also any system where multiple users share\n"
" a given machine. The user does not need to remember\n"
" special ports or passwords set up for his desktop\n"
" and VNC.\n"
" So we see the combination of -display WAIT:cmd=... and\n"
" -unixpw allows automatic pairing of an unix\n"
" authenticated VNC user with his desktop. This could\n"
" be very useful on SunRays and also any system where\n"
" multiple users share a given machine. The user does\n"
" not need to remember special ports or passwords set up\n"
" for his desktop and VNC.\n"
"\n"
" A nice way to use WAIT:cmd=... is out of inetd(8)\n"
" (it automatically forks a new x11vnc for each user).\n"
@ -1504,13 +1525,15 @@ void print_help(int mode) {
" process that will not switch, but it is only encoding\n"
" and decoding the encrypted stream at that point.\n"
"\n"
" Automatic Finding of User X Sessions:\n"
" BUILT-IN modes:\n"
"\n"
" -- Automatic Finding of User X Sessions --\n"
"\n"
" As a special case, WAIT:cmd=FINDDISPLAY will run a\n"
" script that works on most Unixes to determine a user's\n"
" DISPLAY variable and xauthority data (see who(1)).\n"
"\n"
" The option \"-find\" is an alias for this mode.\n"
" NOTE: The option \"-find\" is an alias for this mode.\n"
"\n"
" To have this default script printed to stdout (e.g. for\n"
" customization) run with WAIT:cmd=FINDDISPLAY-print To\n"
@ -1553,7 +1576,12 @@ void print_help(int mode) {
" X11VNC_SKIP_DISPLAY=all then all display finding fails\n"
" as if you set X11VNC_FINDDISPLAY_ALWAYS_FAILS=1 (below.)\n"
"\n"
" Automatic Creation of User X Sessions:\n"
" On some systems lsof(1) can be very slow. Set the\n"
" env. var. FIND_DISPLAY_NO_LSOF=1 to skip using lsof to\n"
" try to find the Linux VT the X server is running on.\n"
" set FIND_DISPLAY_NO_VT_FIND=1 to avoid looking at all.\n"
"\n"
" -- Automatic Creation of User X Sessions --\n"
"\n"
" An interesting option is WAIT:cmd=FINDCREATEDISPLAY\n"
" that is like FINDDISPLAY in that is uses the same method\n"
@ -1562,13 +1590,19 @@ void print_help(int mode) {
" for the user. This is the only time x11vnc tries to\n"
" actually start up an X server.\n"
"\n"
" The option \"-create\" is an alias for this mode.\n"
" NOTE: The option \"-create\" is an alias for this mode.\n"
"\n"
" It will start looking for an open display number at :20\n"
" Override via X11VNC_CREATE_STARTING_DISPLAY_NUMBER=n\n"
" By default 80 X displays are allowed (i.e. going to :99)\n"
" Override via X11VNC_CREATE_MAX_DISPLAYS=n\n"
"\n"
" For its heuristics, the create display script sets\n"
" LC_ALL=C so that command output is uniform. By default\n"
" it will try to restore LC_ALL right before starting the\n"
" user session. However, if you don't mind it keeping\n"
" LC_ALL=C set the env. var.: X11VNC_CREATE_LC_ALL_C_OK=1\n"
"\n"
" By default FINDCREATEDISPLAY will try Xvfb and then\n"
" Xdummy:\n"
"\n"
@ -1595,6 +1629,10 @@ void print_help(int mode) {
" it to terminate (or kill the X server process if all\n"
" else fails).\n"
"\n"
" To troubleshoot the FINDCREATEDISPLAY mechanism,\n"
" set the following env. var. to an output log file,\n"
" e.g -env CREATE_DISPLAY_OUTPUT=/tmp/mydebug.txt\n"
"\n"
" So this is a somewhat odd mode for x11vnc in that it\n"
" will start up and poll virtual X servers! This can\n"
" be used from, say, inetd(8) to provide a means of\n"
@ -4075,6 +4113,7 @@ void print_help(int mode) {
"-sb time Time in seconds after NO activity (e.g. screen blank)\n"
" to really throttle down the screen polls (i.e. sleep\n"
" for about 1.5 secs). Use 0 to disable. Default: %d\n"
" Set the env. var. X11VNC_SB_FACTOR to scale it.\n"
"\n"
"-readtimeout n Set LibVNCServer rfbMaxClientWait to n seconds. On\n"
" slow links that take a long time to paint the first\n"
@ -4520,18 +4559,19 @@ void print_help(int mode) {
" using the 'console_guess' string printed at startup,\n"
" be sure to indicate the snap: method.\n"
"\n"
" uinput: If the Linux version appears to be 2.6 or\n"
" later and the \"uinput\" module appears to be present\n"
" (modprobe uinput), then the uinput method will be used\n"
" instead of /dev/ttyN. uinput allows insertion of BOTH\n"
" keystrokes and mouse input and so it preferred when\n"
" accessing graphical (e.g. QT-embedded) linux console\n"
" apps. See -pipeinput UINPUT below for more information\n"
" on this mode; you will have to use -pipeinput if you\n"
" want to tweak any UINPUT parameters. You may also want\n"
" to also use the -nodragging and -cursor none options.\n"
" Use \"console0\", etc or -pipeinput CONSOLE to force\n"
" the /dev/ttyN method.\n"
" uinput: If the Linux version appears to be 2.6\n"
" or later and the \"uinput\" module appears to be\n"
" present (modprobe uinput), then the uinput method\n"
" will be used instead of /dev/ttyN. uinput allows\n"
" insertion of BOTH keystrokes and mouse input and so it\n"
" preferred when accessing graphical (e.g. QT-embedded)\n"
" linux console apps. It also provides more accurate\n"
" keystroke insertion. See -pipeinput UINPUT below for\n"
" more information on this mode; you will have to use\n"
" -pipeinput if you want to tweak any UINPUT parameters.\n"
" You may also want to also use the -nodragging and\n"
" -cursor none options. Use \"console0\", etc or\n"
" -pipeinput CONSOLE to force the /dev/ttyN method.\n"
"\n"
" Note you can change the Linux VT remotely using the\n"
" chvt(1) command to make the one you want be the active\n"
@ -4571,7 +4611,11 @@ void print_help(int mode) {
" to improve performance in the case of many (e.g. >\n"
" 10) simultaneous VNC viewers, and you try a divide\n"
" and conquer scheme to reduce bandwidth and improve\n"
" responsiveness.\n"
" responsiveness. (However, another user found this mode\n"
" useful to export a demo display through a slow link:\n"
" then multiple demo viewers connected to the reflecting\n"
" x11vnc on the fast side of the link, and so avoided\n"
" all of the demo viewers going through the slow link.)\n"
"\n"
" For example, if there will be 64 simultaneous VNC\n"
" viewers this can lead to a lot of redundant VNC traffic\n"
@ -4602,6 +4646,13 @@ void print_help(int mode) {
" to \"file:path_to_file\" to indicate a file containing\n"
" the password as its first line.\n"
"\n"
" To set the pixel format that x11vnc requests as a VNC\n"
" CLIENT set the env. vars: X11VNC_REFLECT_bitsPerSample\n"
" X11VNC_REFLECT_samplesPerPixel, and\n"
" X11VNC_REFLECT_bytesPerPixel; the defaults are 8, 3, 4.\n"
" 2, 3, 1 would give a low color mode. See the function\n"
" rfbGetClient() in libvncclient for more info.\n"
"\n"
" The VNC HOST mode implies -shared. Use -noshared as\n"
" a subsequent cmdline option to disable sharing.\n"
"\n"
@ -4664,7 +4715,8 @@ void print_help(int mode) {
"\n"
" The UINPUT mode currently only does US keyboards (a\n"
" scan code option may be added), and not all keysyms\n"
" are supported.\n"
" are supported. But it is probably more accurate than\n"
" the \"CONSOLE\" method.\n"
"\n"
" You may want to use the options -cursor none and\n"
" -nodragging in this mode.\n"
@ -4704,16 +4756,6 @@ void print_help(int mode) {
" cause jerkiness or unexpected behavior with menus, etc.\n"
" Use reset=0 to disable.\n"
"\n"
" If the uinput device has an absolute pointer (as opposed\n"
" to a normal mouse that is a relative pointer) you can\n"
" specify the option \"abs\". Note that a touchpad\n"
" on a laptop is an absolute device to some degree.\n"
" This (usually) avoids all the problems with mouse\n"
" acceleration. If x11vnc has trouble deducing the size\n"
" of the device, use \"abs=WxH\". Furthermore, if the\n"
" device is a touchscreen (assumed to have an absolute\n"
" pointer) use \"touch\" or \"touch=WxH\".\n"
"\n"
" If you set the env. var X11VNC_UINPUT_THRESHOLDS then\n"
" the thresh=n mode will be enabled. It is currently\n"
" not working well. If |dx| <= thresh and |dy| < thresh\n"
@ -4723,8 +4765,70 @@ void print_help(int mode) {
" Example:\n"
" -pipeinput UINPUT:accel=4.0 -cursor none\n"
"\n"
" You can also set the env. var X11VNC_UINPUT_DEBUG=1 or\n"
" higher to get debugging output for UINPUT mode.\n"
" If the uinput device has an absolute pointer (as opposed\n"
" to a normal mouse that is a relative pointer) you can\n"
" specify the option \"abs\". Note that a touchpad\n"
" on a laptop is an absolute device to some degree.\n"
" This (usually) avoids all the problems with mouse\n"
" acceleration. If x11vnc has trouble deducing the\n"
" size of the device, use \"abs=WxH\". Furthermore,\n"
" if the device is a touchscreen (assumed to have an\n"
" absolute pointer) use \"touch\" or \"touch=WxH\".\n"
" For touchscreens, when a mouse button is pressed,\n"
" a pressure increase is injected, and when the button\n"
" is released a pressure of zero is injected.\n"
"\n"
" If touch has been set, use \"touch_always=1\" to\n"
" indicate whenever the mouse moves with no button\n"
" pressed, a touch event of zero pressure should be\n"
" sent anyway. Also use \"btn_touch=1\" to indicate a\n"
" BTN_TOUCH keystroke press or release should be sent\n"
" instead of a pressure change. Set \"dragskip=n\" to\n"
" skip n dragged mouse touches (with pressure applied)\n"
" before injecting one. To indicate the pressure that\n"
" should be sent when there is a button click for a\n"
" touchscreen device, specify pressure=n, e.g. n=5. The\n"
" default is n=1.\n"
"\n"
" If a touch screen is being used (\"touch\" above)\n"
" and it is having its input processed by tslib, you can\n"
" specify the tslib calibration file via tslib_cal=<file>.\n"
" For example, tslib_cal=/etc/pointercal. To get accurate\n"
" or even usable positioning this is required when tslib\n"
" is in use.\n"
"\n"
" The Linux uinput mechanism can be bypassed and one can\n"
" write input events DIRECTLY to the devices instead.\n"
" To do this, specify one or more of the following\n"
" for the input classes: direct_rel=<device>\n"
" direct_abs=<device> direct_btn=<device> or\n"
" direct_key=<device>. The <device> file is usually\n"
" something like /dev/input/event1 but you can specify\n"
" any device file or pipe. You must specify each one\n"
" of the above classes even if they correspond to the\n"
" same device file (rel/abs and btn are often the same.)\n"
" Look at the file /proc/bus/input/devices to get an idea\n"
" what is available and the device filenames. Note:\n"
" The /dev/input/mouse* devices do not seem to work,\n"
" use the corresponding /dev/input/event* file instead.\n"
" Any input class not directly specified as above will be\n"
" handled via the uinput mechanism. To disable creating a\n"
" uinput device (and thereby discarding unhandled input),\n"
" specify \"nouinput\".\n"
"\n"
" Examples:\n"
"\n"
" -pipeinput UINPUT:direct_abs=/dev/input/event1\n"
"\n"
" this was used on a qtmoko Neo freerunner (armel):\n"
"\n"
" -pipeinput UINPUT:touch,tslib_cal=/etc/pointercal,\n"
" direct_abs=/dev/input/event1,nouinput,dragskip=4\n"
"\n"
" (where the long line has been split into two.)\n"
"\n"
" You can set the env. var X11VNC_UINPUT_DEBUG=1 or higher\n"
" to get debugging output for UINPUT mode.\n"
"\n"
"-macnodim For the native MacOSX server, disable dimming. \n"
"-macnosleep For the native MacOSX server, disable display sleep.\n"

@ -61,7 +61,7 @@ void check_add_keysyms(void);
int add_keysym(KeySym keysym);
void delete_added_keycodes(int bequiet);
void initialize_remap(char *infile);
int sloppy_key_check(int key, rfbBool down, rfbKeySym keysym, int *new);
int sloppy_key_check(int key, rfbBool down, rfbKeySym keysym, int *new_kc);
void switch_to_xkb_if_better(void);
char *short_kmbcf(char *str);
void initialize_allowed_input(void);
@ -518,7 +518,7 @@ int add_keysym(KeySym keysym) {
for (kc = minkey+1; kc <= maxkey; kc++) {
int i, j, didmsg = 0, is_empty = 1;
char *str;
KeySym new[8];
KeySym newks[8];
for (n=0; n < syms_per_keycode; n++) {
if (keymap[ (kc-minkey) * syms_per_keycode + n]
@ -532,19 +532,19 @@ int add_keysym(KeySym keysym) {
}
for (i=0; i<8; i++) {
new[i] = NoSymbol;
newks[i] = NoSymbol;
}
if (add_keysyms == 2) {
new[0] = keysym; /* XXX remove me */
newks[0] = keysym; /* XXX remove me */
} else {
for(i=0; i < syms_per_keycode; i++) {
new[i] = keysym;
newks[i] = keysym;
if (i >= 7) break;
}
}
XChangeKeyboardMapping(dpy, kc, syms_per_keycode,
new, 1);
newks, 1);
if (alltime_num >= alltime_len) {
didmsg = 1; /* something weird */
@ -584,7 +584,7 @@ static void delete_keycode(KeyCode kc, int bequiet) {
#else
int minkey, maxkey, syms_per_keycode, i;
KeySym *keymap;
KeySym ksym, new[8];
KeySym ksym, newks[8];
char *str;
RAWFB_RET_VOID
@ -594,10 +594,10 @@ static void delete_keycode(KeyCode kc, int bequiet) {
&syms_per_keycode);
for (i=0; i<8; i++) {
new[i] = NoSymbol;
newks[i] = NoSymbol;
}
XChangeKeyboardMapping(dpy, kc, syms_per_keycode, new, 1);
XChangeKeyboardMapping(dpy, kc, syms_per_keycode, newks, 1);
if (! bequiet && ! quiet) {
ksym = XKeycodeToKeysym(dpy, kc, 0);
@ -907,14 +907,14 @@ static int kc1_shift, kc1_control, kc1_caplock, kc1_alt;
static int kc1_meta, kc1_numlock, kc1_super, kc1_hyper;
static int kc1_mode_switch, kc1_iso_level3_shift, kc1_multi_key;
int sloppy_key_check(int key, rfbBool down, rfbKeySym keysym, int *new) {
int sloppy_key_check(int key, rfbBool down, rfbKeySym keysym, int *new_kc) {
if (!sloppy_keys) {
return 0;
}
RAWFB_RET(0)
#if NO_X11
if (!key || !down || !keysym || !new) {}
if (!key || !down || !keysym || !new_kc) {}
return 0;
#else
@ -958,7 +958,7 @@ int sloppy_key_check(int key, rfbBool down, rfbKeySym keysym, int *new) {
"-> %d/0x%x (nmods: %d)\n", (int) key,
(int) key, downkey, downkey, nmods_down);
}
*new = downkey;
*new_kc = downkey;
return 1;
}
}

@ -48,7 +48,7 @@ extern void check_add_keysyms(void);
extern int add_keysym(KeySym keysym);
extern void delete_added_keycodes(int bequiet);
extern void initialize_remap(char *infile);
extern int sloppy_key_check(int key, rfbBool down, rfbKeySym keysym, int *new);
extern int sloppy_key_check(int key, rfbBool down, rfbKeySym keysym, int *new_kc);
extern void switch_to_xkb_if_better(void);
extern char *short_kmbcf(char *str);
extern void initialize_allowed_input(void);

@ -265,6 +265,7 @@ char *console_guess(char *str, int *fd) {
} else {
sprintf(q, "map:%s@%s", file, atparms);
}
free(atparms);
return q;
}

@ -241,6 +241,7 @@ char *macosx_console_guess(char *str, int *fd) {
q = (char *) malloc(strlen("map:macosx:") + strlen(file) + 1 + strlen(atparms) + 1);
sprintf(q, "map:macosx:%s@%s", file, atparms);
free(atparms);
return q;
}

@ -87,7 +87,9 @@ int dragum(void) {
CGPoint loc;
CGDirectDisplayID displayID2 = kCGDirectMainDisplay;
#ifdef X11VNC_MACOSX_USE_GETMAINDEVICE
(void) GetMainDevice();
#endif
for (i=0; i< 50; i++) {
usleep(1000*100);
@ -140,7 +142,9 @@ void macosxCG_init(void) {
#endif
displayID = kCGDirectMainDisplay;
#ifdef X11VNC_MACOSX_USE_GETMAINDEVICE
(void) GetMainDevice();
#endif
CGSetLocalEventsSuppressionInterval(0.0);
CGSetLocalEventsFilterDuringSupressionState(

@ -1,3 +1,3 @@
SUBDIRS = turbovnc
DIST_SUBDIRS = turbovnc
EXTRA_DIST=README blockdpy.c dtVncPopup rx11vnc rx11vnc.pl shm_clear ranfb.pl slide.pl vcinject.pl x11vnc_loop Xdummy ultravnc_repeater.pl connect_switch panner.pl desktop.cgi inet6to4
EXTRA_DIST=README blockdpy.c dtVncPopup rx11vnc rx11vnc.pl shm_clear ranfb.pl slide.pl vcinject.pl x11vnc_loop Xdummy ultravnc_repeater.pl connect_switch panner.pl desktop.cgi inet6to4 uinput.pl qt_tslib_inject.pl

@ -26,6 +26,10 @@ x11vnc -pipeinput/-rawfb utilities:
slide.pl amusing example using x11vnc -rawfb for jpeg slideshow.
ranfb.pl example -rawfb setup:./ranfb.pl to set up a framebuffer.
uinput.pl test perl script for Linux uinput injection.
qt_tslib_inject.pl touchscreen -pipeinput helper for tslib on qtmoko.
Misc. scripts:
shm_clear list or remove orphaned shm slots from hard x11vnc crashes.

File diff suppressed because it is too large Load Diff

@ -0,0 +1,946 @@
#!/usr/bin/perl
# This is a test injection script for Linux uinput.
# It can be handy working out / troubleshooting Linux uinput injection on a new device.
#
# Copyright (c) 2010 by Karl J. Runge <runge@karlrunge.com>
#
# uinput.pl is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# uinput.pl is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with uinput.pl; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA
# or see <http://www.gnu.org/licenses/>.
#
set_constants();
# options for what injection to handle:
$rel = 1;
$abs = 1;
$touch = 1;
$allkeys = 1;
# these can be set via env:
$WIDTH = $ENV{WIDTH};
$WIDTH = 480 unless $WIDTH;
$HEIGHT = $ENV{HEIGHT};
$HEIGHT = 640 unless $HEIGHT;
$DEV = $ENV{DEV};
$DEV = "/dev/input/uinput" unless $DEV;
# this fills in name and input type part of uinput_user_dev struct:
$udev = "uinput.pl";
$n = 80 - length($udev);
$udev .= "\0" x $n;
$udev .= "\0" x 2; # bus
$udev .= "\0" x 2; # vendor
$udev .= "\0" x 2; # product
$udev .= "\0" x 2; # version
$udev .= "\0" x 4; # ff_effects_max
# this fills in the abs arrays:
#
foreach $type (qw(absmax absmin absfuzz absflat)) {
$n = $ABS_MAX + 1;
for ($j = 0; $j < $n; $j++) {
if ($abs && $type eq 'absmax' && $j == $ABS_X) {
$udev .= pack("i", $WIDTH-1);
} elsif ($abs && $type eq 'absmax' && $j == $ABS_Y) {
$udev .= pack("i", $HEIGHT-1);
} else {
$udev .= "\0" x 4;
}
}
}
print "udev: ", length($udev) . " '$udev'\n";
$modes = $O_RDWR;
$modes = $O_WRONLY | $O_NDELAY;
printf("open modes: 0x%x\n", $modes);
sysopen(FD, $DEV, $modes) || die "$DEV: $!";
if ($rel) {
io_ctl($UI_SET_EVBIT, $EV_REL);
io_ctl($UI_SET_RELBIT, $REL_X);
io_ctl($UI_SET_RELBIT, $REL_Y);
}
io_ctl($UI_SET_EVBIT, $EV_KEY);
io_ctl($UI_SET_EVBIT, $EV_SYN);
for ($i=0; $i < 256; $i++) {
last unless $allkeys;
io_ctl($UI_SET_KEYBIT, $i);
}
io_ctl($UI_SET_KEYBIT, $BTN_MOUSE);
io_ctl($UI_SET_KEYBIT, $BTN_LEFT);
io_ctl($UI_SET_KEYBIT, $BTN_MIDDLE);
io_ctl($UI_SET_KEYBIT, $BTN_RIGHT);
io_ctl($UI_SET_KEYBIT, $BTN_FORWARD);
io_ctl($UI_SET_KEYBIT, $BTN_BACK);
if ($abs) {
io_ctl($UI_SET_KEYBIT, $BTN_TOUCH) if $touch;
io_ctl($UI_SET_EVBIT, $EV_ABS);
io_ctl($UI_SET_ABSBIT, $ABS_X);
io_ctl($UI_SET_ABSBIT, $ABS_Y);
}
$ret = syswrite(FD, $udev, length($udev));
print "syswrite: $ret\n";
io_ctl($UI_DEV_CREATE);
fsleep(0.25);
# this should show our new virtual device:
#
system("cat /proc/bus/input/devices 1>&2");
print STDERR "\n";
#################################################
# put in your various test injection events here:
#do_key($KEY_A, 1, 0.1);
#do_key($KEY_A, 0, 0.1);
#do_key($KEY_POWER, 1, 0.1);
#do_key($KEY_POWER, 0, 0.1);
do_abs(118, 452, 0, 0.1);
do_abs(110, 572, 1, 0.1);
do_btn($BTN_TOUCH, 1, 0.1);
do_btn($BTN_TOUCH, 0, 0.1);
do_btn($BTN_MOUSE, 1, 0.1);
do_btn($BTN_MOUSE, 0, 0.1);
#################################################
fsleep(0.25);
io_ctl($UI_DEV_DESTROY);
close(FD);
exit(0);
sub io_ctl {
my ($cmd, $val) = @_;
if (defined $val) {
my $ret = syscall($linux_ioctl_syscall, fileno(FD), $cmd, $val);
my $err = $!; $err = '' if $ret == 0;
print STDERR "io_ctl(FD, $cmd, $val) = $ret $err\n";
} else {
my $ret = syscall($linux_ioctl_syscall, fileno(FD), $cmd);
my $err = $!; $err = '' if $ret == 0;
print STDERR "io_ctl(FD, $cmd) = $ret $err\n";
}
}
sub do_syn {
my $ev = gtod();
$ev .= pack("S", $EV_SYN);
$ev .= pack("S", $SYN_REPORT);
$ev .= pack("i", 0);
print STDERR "do_syn EV_SYN\n";
my $ret = syswrite(FD, $ev, length($ev));
if (!defined $ret) {
print STDERR "do_syn: $!\n";
}
}
sub do_key {
my ($key, $down, $sleep) = @_;
my $ev = gtod();
$ev .= pack("S", $EV_KEY);
$ev .= pack("S", $key);
$ev .= pack("i", $down);
print STDERR "do_key $key $down\n";
my $ret = syswrite(FD, $ev, length($ev));
if (!defined $ret) {
print STDERR "do_key: $!\n";
}
do_syn();
fsleep($sleep);
print STDERR "\n";
}
sub do_btn {
my ($button, $down, $sleep) = @_;
my $ev = gtod();
$ev .= pack("S", $EV_KEY);
$ev .= pack("S", $button);
$ev .= pack("i", $down);
print STDERR "do_btn $button $down\n";
my $ret = syswrite(FD, $ev, length($ev));
if (!defined $ret) {
print STDERR "do_btn: $!\n";
}
do_syn();
fsleep($sleep);
print STDERR "\n";
}
sub do_abs {
my ($x, $y, $p, $sleep) = @_;
my $ev = gtod();
$ev .= pack("S", $EV_ABS);
$ev .= pack("S", $ABS_Y);
$ev .= pack("i", $y);
print STDERR "do_abs y=$y\n";
my $ret = syswrite(FD, $ev, length($ev));
if (!defined $ret) {
print STDERR "do_abs: $!\n";
}
$ev = gtod();
$ev .= pack("S", $EV_ABS);
$ev .= pack("S", $ABS_X);
$ev .= pack("i", $x);
print STDERR "do_abs x=$x\n";
$ret = syswrite(FD, $ev, length($ev));
if (!defined $ret) {
print STDERR "do_abs: $!\n";
}
$ev = gtod();
$ev .= pack("S", $EV_ABS);
$ev .= pack("S", $ABS_PRESSURE);
$ev .= pack("i", $p);
print STDERR "do_abs p=$p\n";
$ret = syswrite(FD, $ev, length($ev));
if (!defined $ret) {
print STDERR "do_abs: $!\n";
}
do_syn();
fsleep($sleep);
print STDERR "\n";
}
sub do_rel {
my ($dx, $dy, $sleep) = @_;
my $ev = gtod();
$ev .= pack("S", $EV_REL);
$ev .= pack("S", $REL_Y);
$ev .= pack("i", $dy);
print STDERR "do_rel dy=$dy\n";
my $ret = syswrite(FD, $ev, length($ev));
if (!defined $ret) {
print STDERR "do_rel: $!\n";
}
$ev = gtod();
$ev .= pack("S", $EV_REL);
$ev .= pack("S", $REL_X);
$ev .= pack("i", $dx);
print STDERR "do_rel dx=$dx\n";
$ret = syswrite(FD, $ev, length($ev));
if (!defined $ret) {
print STDERR "do_rel: $!\n";
}
do_syn();
fsleep($sleep);
print STDERR "\n";
}
sub gtod {
$tv = ("\0" x 4) x 2; # assumes long is 4 bytes. FIXME: use pack.
$tz = ("\0" x 4) x 2;
syscall($linux_gettimeofday_syscall, $tv, $tz);
return $tv;
}
sub fsleep {
my ($time) = @_;
select(undef, undef, undef, $time) if $time;
}
sub set_constants {
# from /usr/include/linux/uinput.h /usr/include/linux/input.h and x11vnc.
# #define ABS_MAX 0x3f = 63
#
# #define UINPUT_MAX_NAME_SIZE 80
#
# struct input_id {
# __u16 bustype;
# __u16 vendor;
# __u16 product;
# __u16 version;
# };
#
# struct uinput_user_dev {
# char name[UINPUT_MAX_NAME_SIZE];
# struct input_id id;
# int ff_effects_max;
# int absmax[ABS_MAX + 1];
# int absmin[ABS_MAX + 1];
# int absfuzz[ABS_MAX + 1];
# int absflat[ABS_MAX + 1];
# };
# #endif /* __UINPUT_H_ */
$EV_SYN = 0x00;
$EV_KEY = 0x01;
$EV_REL = 0x02;
$EV_ABS = 0x03;
$EV_MSC = 0x04;
$EV_SW = 0x05;
$EV_LED = 0x11;
$EV_SND = 0x12;
$EV_REP = 0x14;
$EV_FF = 0x15;
$EV_PWR = 0x16;
$EV_FF_STATUS = 0x17;
$EV_MAX = 0x1f;
$ID_BUS = 0;
$ID_VENDOR = 1;
$ID_PRODUCT = 2;
$ID_VERSION = 3;
$BUS_PCI = 0x01;
$BUS_ISAPNP = 0x02;
$BUS_USB = 0x03;
$BUS_HIL = 0x04;
$BUS_BLUETOOTH = 0x05;
$BUS_VIRTUAL = 0x06;
$BUS_ISA = 0x10;
$BUS_I8042 = 0x11;
$BUS_XTKBD = 0x12;
$BUS_RS232 = 0x13;
$BUS_GAMEPORT = 0x14;
$BUS_PARPORT = 0x15;
$BUS_AMIGA = 0x16;
$BUS_ADB = 0x17;
$BUS_I2C = 0x18;
$BUS_HOST = 0x19;
$BUS_GSC = 0x1A;
$BUS_ATARI = 0x1B;
$REL_X = 0x00;
$REL_Y = 0x01;
$REL_Z = 0x02;
$REL_RX = 0x03;
$REL_RY = 0x04;
$REL_RZ = 0x05;
$REL_HWHEEL = 0x06;
$REL_DIAL = 0x07;
$REL_WHEEL = 0x08;
$REL_MISC = 0x09;
$ABS_X = 0x00;
$ABS_Y = 0x01;
$ABS_Z = 0x02;
$ABS_RX = 0x03;
$ABS_RY = 0x04;
$ABS_RZ = 0x05;
$ABS_THROTTLE = 0x06;
$ABS_RUDDER = 0x07;
$ABS_WHEEL = 0x08;
$ABS_GAS = 0x09;
$ABS_BRAKE = 0x0a;
$ABS_HAT0X = 0x10;
$ABS_HAT0Y = 0x11;
$ABS_HAT1X = 0x12;
$ABS_HAT1Y = 0x13;
$ABS_HAT2X = 0x14;
$ABS_HAT2Y = 0x15;
$ABS_HAT3X = 0x16;
$ABS_HAT3Y = 0x17;
$ABS_PRESSURE = 0x18;
$ABS_DISTANCE = 0x19;
$ABS_TILT_X = 0x1a;
$ABS_TILT_Y = 0x1b;
$ABS_TOOL_WIDTH = 0x1c;
$ABS_VOLUME = 0x20;
$ABS_MISC = 0x28;
$ABS_MT_TOUCH_MAJOR = 0x30;
$ABS_MT_TOUCH_MINOR = 0x31;
$ABS_MT_WIDTH_MAJOR = 0x32;
$ABS_MT_WIDTH_MINOR = 0x33;
$ABS_MT_ORIENTATION = 0x34;
$ABS_MT_POSITION_X = 0x35;
$ABS_MT_POSITION_Y = 0x36;
$ABS_MT_TOOL_TYPE = 0x37;
$ABS_MT_BLOB_ID = 0x38;
$ABS_MT_TRACKING_ID = 0x39;
#$ABS_MAX = 0x3f;
$BTN_MISC = 0x100;
$BTN_0 = 0x100;
$BTN_1 = 0x101;
$BTN_2 = 0x102;
$BTN_3 = 0x103;
$BTN_4 = 0x104;
$BTN_5 = 0x105;
$BTN_6 = 0x106;
$BTN_7 = 0x107;
$BTN_8 = 0x108;
$BTN_9 = 0x109;
$BTN_MOUSE = 0x110;
$BTN_LEFT = 0x110;
$BTN_RIGHT = 0x111;
$BTN_MIDDLE = 0x112;
$BTN_SIDE = 0x113;
$BTN_EXTRA = 0x114;
$BTN_FORWARD = 0x115;
$BTN_BACK = 0x116;
$BTN_TASK = 0x117;
$BTN_JOYSTICK = 0x120;
$BTN_TRIGGER = 0x120;
$BTN_THUMB = 0x121;
$BTN_THUMB2 = 0x122;
$BTN_TOP = 0x123;
$BTN_TOP2 = 0x124;
$BTN_PINKIE = 0x125;
$BTN_BASE = 0x126;
$BTN_BASE2 = 0x127;
$BTN_BASE3 = 0x128;
$BTN_BASE4 = 0x129;
$BTN_BASE5 = 0x12a;
$BTN_BASE6 = 0x12b;
$BTN_DEAD = 0x12f;
$BTN_GAMEPAD = 0x130;
$BTN_A = 0x130;
$BTN_B = 0x131;
$BTN_C = 0x132;
$BTN_X = 0x133;
$BTN_Y = 0x134;
$BTN_Z = 0x135;
$BTN_TL = 0x136;
$BTN_TR = 0x137;
$BTN_TL2 = 0x138;
$BTN_TR2 = 0x139;
$BTN_SELECT = 0x13a;
$BTN_START = 0x13b;
$BTN_MODE = 0x13c;
$BTN_THUMBL = 0x13d;
$BTN_THUMBR = 0x13e;
$BTN_DIGI = 0x140;
$BTN_TOOL_PEN = 0x140;
$BTN_TOOL_RUBBER = 0x141;
$BTN_TOOL_BRUSH = 0x142;
$BTN_TOOL_PENCIL = 0x143;
$BTN_TOOL_AIRBRUSH = 0x144;
$BTN_TOOL_FINGER = 0x145;
$BTN_TOOL_MOUSE = 0x146;
$BTN_TOOL_LENS = 0x147;
$BTN_TOUCH = 0x14a;
$BTN_STYLUS = 0x14b;
$BTN_STYLUS2 = 0x14c;
$BTN_TOOL_DOUBLETAP = 0x14d;
$BTN_TOOL_TRIPLETAP = 0x14e;
$BTN_WHEEL = 0x150;
$BTN_GEAR_DOWN = 0x150;
$BTN_GEAR_UP = 0x151;
$SYN_REPORT = 0;
$SYN_CONFIG = 1;
$SYN_MT_REPORT = 2;
$KEY_RESERVED = 0;
$KEY_ESC = 1;
$KEY_1 = 2;
$KEY_2 = 3;
$KEY_3 = 4;
$KEY_4 = 5;
$KEY_5 = 6;
$KEY_6 = 7;
$KEY_7 = 8;
$KEY_8 = 9;
$KEY_9 = 10;
$KEY_0 = 11;
$KEY_MINUS = 12;
$KEY_EQUAL = 13;
$KEY_BACKSPACE = 14;
$KEY_TAB = 15;
$KEY_Q = 16;
$KEY_W = 17;
$KEY_E = 18;
$KEY_R = 19;
$KEY_T = 20;
$KEY_Y = 21;
$KEY_U = 22;
$KEY_I = 23;
$KEY_O = 24;
$KEY_P = 25;
$KEY_LEFTBRACE = 26;
$KEY_RIGHTBRACE = 27;
$KEY_ENTER = 28;
$KEY_LEFTCTRL = 29;
$KEY_A = 30;
$KEY_S = 31;
$KEY_D = 32;
$KEY_F = 33;
$KEY_G = 34;
$KEY_H = 35;
$KEY_J = 36;
$KEY_K = 37;
$KEY_L = 38;
$KEY_SEMICOLON = 39;
$KEY_APOSTROPHE = 40;
$KEY_GRAVE = 41;
$KEY_LEFTSHIFT = 42;
$KEY_BACKSLASH = 43;
$KEY_Z = 44;
$KEY_X = 45;
$KEY_C = 46;
$KEY_V = 47;
$KEY_B = 48;
$KEY_N = 49;
$KEY_M = 50;
$KEY_COMMA = 51;
$KEY_DOT = 52;
$KEY_SLASH = 53;
$KEY_RIGHTSHIFT = 54;
$KEY_KPASTERISK = 55;
$KEY_LEFTALT = 56;
$KEY_SPACE = 57;
$KEY_CAPSLOCK = 58;
$KEY_F1 = 59;
$KEY_F2 = 60;
$KEY_F3 = 61;
$KEY_F4 = 62;
$KEY_F5 = 63;
$KEY_F6 = 64;
$KEY_F7 = 65;
$KEY_F8 = 66;
$KEY_F9 = 67;
$KEY_F10 = 68;
$KEY_NUMLOCK = 69;
$KEY_SCROLLLOCK = 70;
$KEY_KP7 = 71;
$KEY_KP8 = 72;
$KEY_KP9 = 73;
$KEY_KPMINUS = 74;
$KEY_KP4 = 75;
$KEY_KP5 = 76;
$KEY_KP6 = 77;
$KEY_KPPLUS = 78;
$KEY_KP1 = 79;
$KEY_KP2 = 80;
$KEY_KP3 = 81;
$KEY_KP0 = 82;
$KEY_KPDOT = 83;
$KEY_103RD = 84;
$KEY_F13 = 85;
$KEY_102ND = 86;
$KEY_F11 = 87;
$KEY_F12 = 88;
$KEY_F14 = 89;
$KEY_F15 = 90;
$KEY_F16 = 91;
$KEY_F17 = 92;
$KEY_F18 = 93;
$KEY_F19 = 94;
$KEY_F20 = 95;
$KEY_KPENTER = 96;
$KEY_RIGHTCTRL = 97;
$KEY_KPSLASH = 98;
$KEY_SYSRQ = 99;
$KEY_RIGHTALT = 100;
$KEY_LINEFEED = 101;
$KEY_HOME = 102;
$KEY_UP = 103;
$KEY_PAGEUP = 104;
$KEY_LEFT = 105;
$KEY_RIGHT = 106;
$KEY_END = 107;
$KEY_DOWN = 108;
$KEY_PAGEDOWN = 109;
$KEY_INSERT = 110;
$KEY_DELETE = 111;
$KEY_MACRO = 112;
$KEY_MUTE = 113;
$KEY_VOLUMEDOWN = 114;
$KEY_VOLUMEUP = 115;
$KEY_POWER = 116;
$KEY_KPEQUAL = 117;
$KEY_KPPLUSMINUS = 118;
$KEY_PAUSE = 119;
$KEY_F21 = 120;
$KEY_F22 = 121;
$KEY_F23 = 122;
$KEY_F24 = 123;
$KEY_KPCOMMA = 124;
$KEY_LEFTMETA = 125;
$KEY_RIGHTMETA = 126;
$KEY_COMPOSE = 127;
$KEY_STOP = 128;
$KEY_AGAIN = 129;
$KEY_PROPS = 130;
$KEY_UNDO = 131;
$KEY_FRONT = 132;
$KEY_COPY = 133;
$KEY_OPEN = 134;
$KEY_PASTE = 135;
$KEY_FIND = 136;
$KEY_CUT = 137;
$KEY_HELP = 138;
$KEY_MENU = 139;
$KEY_CALC = 140;
$KEY_SETUP = 141;
$KEY_SLEEP = 142;
$KEY_WAKEUP = 143;
$KEY_FILE = 144;
$KEY_SENDFILE = 145;
$KEY_DELETEFILE = 146;
$KEY_XFER = 147;
$KEY_PROG1 = 148;
$KEY_PROG2 = 149;
$KEY_WWW = 150;
$KEY_MSDOS = 151;
$KEY_COFFEE = 152;
$KEY_DIRECTION = 153;
$KEY_CYCLEWINDOWS = 154;
$KEY_MAIL = 155;
$KEY_BOOKMARKS = 156;
$KEY_COMPUTER = 157;
$KEY_BACK = 158;
$KEY_FORWARD = 159;
$KEY_CLOSECD = 160;
$KEY_EJECTCD = 161;
$KEY_EJECTCLOSECD = 162;
$KEY_NEXTSONG = 163;
$KEY_PLAYPAUSE = 164;
$KEY_PREVIOUSSONG = 165;
$KEY_STOPCD = 166;
$KEY_RECORD = 167;
$KEY_REWIND = 168;
$KEY_PHONE = 169;
$KEY_ISO = 170;
$KEY_CONFIG = 171;
$KEY_HOMEPAGE = 172;
$KEY_REFRESH = 173;
$KEY_EXIT = 174;
$KEY_MOVE = 175;
$KEY_EDIT = 176;
$KEY_SCROLLUP = 177;
$KEY_SCROLLDOWN = 178;
$KEY_KPLEFTPAREN = 179;
$KEY_KPRIGHTPAREN = 180;
$KEY_INTL1 = 181;
$KEY_INTL2 = 182;
$KEY_INTL3 = 183;
$KEY_INTL4 = 184;
$KEY_INTL5 = 185;
$KEY_INTL6 = 186;
$KEY_INTL7 = 187;
$KEY_INTL8 = 188;
$KEY_INTL9 = 189;
$KEY_LANG1 = 190;
$KEY_LANG2 = 191;
$KEY_LANG3 = 192;
$KEY_LANG4 = 193;
$KEY_LANG5 = 194;
$KEY_LANG6 = 195;
$KEY_LANG7 = 196;
$KEY_LANG8 = 197;
$KEY_LANG9 = 198;
$KEY_PLAYCD = 200;
$KEY_PAUSECD = 201;
$KEY_PROG3 = 202;
$KEY_PROG4 = 203;
$KEY_SUSPEND = 205;
$KEY_CLOSE = 206;
$KEY_PLAY = 207;
$KEY_FASTFORWARD = 208;
$KEY_BASSBOOST = 209;
$KEY_PRINT = 210;
$KEY_HP = 211;
$KEY_CAMERA = 212;
$KEY_SOUND = 213;
$KEY_QUESTION = 214;
$KEY_EMAIL = 215;
$KEY_CHAT = 216;
$KEY_SEARCH = 217;
$KEY_CONNECT = 218;
$KEY_FINANCE = 219;
$KEY_SPORT = 220;
$KEY_SHOP = 221;
$KEY_ALTERASE = 222;
$KEY_CANCEL = 223;
$KEY_BRIGHTNESSDOWN = 224;
$KEY_BRIGHTNESSUP = 225;
$KEY_MEDIA = 226;
$KEY_UNKNOWN = 240;
$KEY_OK = 0x160;
$KEY_SELECT = 0x161;
$KEY_GOTO = 0x162;
$KEY_CLEAR = 0x163;
$KEY_POWER2 = 0x164;
$KEY_OPTION = 0x165;
$KEY_INFO = 0x166;
$KEY_TIME = 0x167;
$KEY_VENDOR = 0x168;
$KEY_ARCHIVE = 0x169;
$KEY_PROGRAM = 0x16a;
$KEY_CHANNEL = 0x16b;
$KEY_FAVORITES = 0x16c;
$KEY_EPG = 0x16d;
$KEY_PVR = 0x16e;
$KEY_MHP = 0x16f;
$KEY_LANGUAGE = 0x170;
$KEY_TITLE = 0x171;
$KEY_SUBTITLE = 0x172;
$KEY_ANGLE = 0x173;
$KEY_ZOOM = 0x174;
$KEY_MODE = 0x175;
$KEY_KEYBOARD = 0x176;
$KEY_SCREEN = 0x177;
$KEY_PC = 0x178;
$KEY_TV = 0x179;
$KEY_TV2 = 0x17a;
$KEY_VCR = 0x17b;
$KEY_VCR2 = 0x17c;
$KEY_SAT = 0x17d;
$KEY_SAT2 = 0x17e;
$KEY_CD = 0x17f;
$KEY_TAPE = 0x180;
$KEY_RADIO = 0x181;
$KEY_TUNER = 0x182;
$KEY_PLAYER = 0x183;
$KEY_TEXT = 0x184;
$KEY_DVD = 0x185;
$KEY_AUX = 0x186;
$KEY_MP3 = 0x187;
$KEY_AUDIO = 0x188;
$KEY_VIDEO = 0x189;
$KEY_DIRECTORY = 0x18a;
$KEY_LIST = 0x18b;
$KEY_MEMO = 0x18c;
$KEY_CALENDAR = 0x18d;
$KEY_RED = 0x18e;
$KEY_GREEN = 0x18f;
$KEY_YELLOW = 0x190;
$KEY_BLUE = 0x191;
$KEY_CHANNELUP = 0x192;
$KEY_CHANNELDOWN = 0x193;
$KEY_FIRST = 0x194;
$KEY_LAST = 0x195;
$KEY_AB = 0x196;
$KEY_NEXT = 0x197;
$KEY_RESTART = 0x198;
$KEY_SLOW = 0x199;
$KEY_SHUFFLE = 0x19a;
$KEY_BREAK = 0x19b;
$KEY_PREVIOUS = 0x19c;
$KEY_DIGITS = 0x19d;
$KEY_TEEN = 0x19e;
$KEY_TWEN = 0x19f;
$KEY_DEL_EOL = 0x1c0;
$KEY_DEL_EOS = 0x1c1;
$KEY_INS_LINE = 0x1c2;
$KEY_DEL_LINE = 0x1c3;
$KEY_MAX = 0x1ff;
$key_lookup{XK_Escape} = $KEY_ESC;
$key_lookup{XK_1} = $KEY_1;
$key_lookup{XK_2} = $KEY_2;
$key_lookup{XK_3} = $KEY_3;
$key_lookup{XK_4} = $KEY_4;
$key_lookup{XK_5} = $KEY_5;
$key_lookup{XK_6} = $KEY_6;
$key_lookup{XK_7} = $KEY_7;
$key_lookup{XK_8} = $KEY_8;
$key_lookup{XK_9} = $KEY_9;
$key_lookup{XK_0} = $KEY_0;
$key_lookup{XK_exclam} = $KEY_1;
$key_lookup{XK_at} = $KEY_2;
$key_lookup{XK_numbersign} = $KEY_3;
$key_lookup{XK_dollar} = $KEY_4;
$key_lookup{XK_percent} = $KEY_5;
$key_lookup{XK_asciicircum} = $KEY_6;
$key_lookup{XK_ampersand} = $KEY_7;
$key_lookup{XK_asterisk} = $KEY_8;
$key_lookup{XK_parenleft} = $KEY_9;
$key_lookup{XK_parenright} = $KEY_0;
$key_lookup{XK_minus} = $KEY_MINUS;
$key_lookup{XK_underscore} = $KEY_MINUS;
$key_lookup{XK_equal} = $KEY_EQUAL;
$key_lookup{XK_plus} = $KEY_EQUAL;
$key_lookup{XK_BackSpace} = $KEY_BACKSPACE;
$key_lookup{XK_Tab} = $KEY_TAB;
$key_lookup{XK_q} = $KEY_Q;
$key_lookup{XK_Q} = $KEY_Q;
$key_lookup{XK_w} = $KEY_W;
$key_lookup{XK_W} = $KEY_W;
$key_lookup{XK_e} = $KEY_E;
$key_lookup{XK_E} = $KEY_E;
$key_lookup{XK_r} = $KEY_R;
$key_lookup{XK_R} = $KEY_R;
$key_lookup{XK_t} = $KEY_T;
$key_lookup{XK_T} = $KEY_T;
$key_lookup{XK_y} = $KEY_Y;
$key_lookup{XK_Y} = $KEY_Y;
$key_lookup{XK_u} = $KEY_U;
$key_lookup{XK_U} = $KEY_U;
$key_lookup{XK_i} = $KEY_I;
$key_lookup{XK_I} = $KEY_I;
$key_lookup{XK_o} = $KEY_O;
$key_lookup{XK_O} = $KEY_O;
$key_lookup{XK_p} = $KEY_P;
$key_lookup{XK_P} = $KEY_P;
$key_lookup{XK_braceleft} = $KEY_LEFTBRACE;
$key_lookup{XK_braceright} = $KEY_RIGHTBRACE;
$key_lookup{XK_bracketleft} = $KEY_LEFTBRACE;
$key_lookup{XK_bracketright} = $KEY_RIGHTBRACE;
$key_lookup{XK_Return} = $KEY_ENTER;
$key_lookup{XK_Control_L} = $KEY_LEFTCTRL;
$key_lookup{XK_a} = $KEY_A;
$key_lookup{XK_A} = $KEY_A;
$key_lookup{XK_s} = $KEY_S;
$key_lookup{XK_S} = $KEY_S;
$key_lookup{XK_d} = $KEY_D;
$key_lookup{XK_D} = $KEY_D;
$key_lookup{XK_f} = $KEY_F;
$key_lookup{XK_F} = $KEY_F;
$key_lookup{XK_g} = $KEY_G;
$key_lookup{XK_G} = $KEY_G;
$key_lookup{XK_h} = $KEY_H;
$key_lookup{XK_H} = $KEY_H;
$key_lookup{XK_j} = $KEY_J;
$key_lookup{XK_J} = $KEY_J;
$key_lookup{XK_k} = $KEY_K;
$key_lookup{XK_K} = $KEY_K;
$key_lookup{XK_l} = $KEY_L;
$key_lookup{XK_L} = $KEY_L;
$key_lookup{XK_semicolon} = $KEY_SEMICOLON;
$key_lookup{XK_colon} = $KEY_SEMICOLON;
$key_lookup{XK_apostrophe} = $KEY_APOSTROPHE;
$key_lookup{XK_quotedbl} = $KEY_APOSTROPHE;
$key_lookup{XK_grave} = $KEY_GRAVE;
$key_lookup{XK_asciitilde} = $KEY_GRAVE;
$key_lookup{XK_Shift_L} = $KEY_LEFTSHIFT;
$key_lookup{XK_backslash} = $KEY_BACKSLASH;
$key_lookup{XK_bar} = $KEY_BACKSLASH;
$key_lookup{XK_z} = $KEY_Z;
$key_lookup{XK_Z} = $KEY_Z;
$key_lookup{XK_x} = $KEY_X;
$key_lookup{XK_X} = $KEY_X;
$key_lookup{XK_c} = $KEY_C;
$key_lookup{XK_C} = $KEY_C;
$key_lookup{XK_v} = $KEY_V;
$key_lookup{XK_V} = $KEY_V;
$key_lookup{XK_b} = $KEY_B;
$key_lookup{XK_B} = $KEY_B;
$key_lookup{XK_n} = $KEY_N;
$key_lookup{XK_N} = $KEY_N;
$key_lookup{XK_m} = $KEY_M;
$key_lookup{XK_M} = $KEY_M;
$key_lookup{XK_comma} = $KEY_COMMA;
$key_lookup{XK_less} = $KEY_COMMA;
$key_lookup{XK_period} = $KEY_DOT;
$key_lookup{XK_greater} = $KEY_DOT;
$key_lookup{XK_slash} = $KEY_SLASH;
$key_lookup{XK_question} = $KEY_SLASH;
$key_lookup{XK_Shift_R} = $KEY_RIGHTSHIFT;
$key_lookup{XK_KP_Multiply} = $KEY_KPASTERISK;
$key_lookup{XK_Alt_L} = $KEY_LEFTALT;
$key_lookup{XK_space} = $KEY_SPACE;
$key_lookup{XK_Caps_Lock} = $KEY_CAPSLOCK;
$key_lookup{XK_F1} = $KEY_F1;
$key_lookup{XK_F2} = $KEY_F2;
$key_lookup{XK_F3} = $KEY_F3;
$key_lookup{XK_F4} = $KEY_F4;
$key_lookup{XK_F5} = $KEY_F5;
$key_lookup{XK_F6} = $KEY_F6;
$key_lookup{XK_F7} = $KEY_F7;
$key_lookup{XK_F8} = $KEY_F8;
$key_lookup{XK_F9} = $KEY_F9;
$key_lookup{XK_F10} = $KEY_F10;
$key_lookup{XK_Num_Lock} = $KEY_NUMLOCK;
$key_lookup{XK_Scroll_Lock} = $KEY_SCROLLLOCK;
$key_lookup{XK_KP_7} = $KEY_KP7;
$key_lookup{XK_KP_8} = $KEY_KP8;
$key_lookup{XK_KP_9} = $KEY_KP9;
$key_lookup{XK_KP_Subtract} = $KEY_KPMINUS;
$key_lookup{XK_KP_4} = $KEY_KP4;
$key_lookup{XK_KP_5} = $KEY_KP5;
$key_lookup{XK_KP_6} = $KEY_KP6;
$key_lookup{XK_KP_Add} = $KEY_KPPLUS;
$key_lookup{XK_KP_1} = $KEY_KP1;
$key_lookup{XK_KP_2} = $KEY_KP2;
$key_lookup{XK_KP_3} = $KEY_KP3;
$key_lookup{XK_KP_0} = $KEY_KP0;
$key_lookup{XK_KP_Decimal} = $KEY_KPDOT;
$key_lookup{XK_F13} = $KEY_F13;
$key_lookup{XK_F11} = $KEY_F11;
$key_lookup{XK_F12} = $KEY_F12;
$key_lookup{XK_F14} = $KEY_F14;
$key_lookup{XK_F15} = $KEY_F15;
$key_lookup{XK_F16} = $KEY_F16;
$key_lookup{XK_F17} = $KEY_F17;
$key_lookup{XK_F18} = $KEY_F18;
$key_lookup{XK_F19} = $KEY_F19;
$key_lookup{XK_F20} = $KEY_F20;
$key_lookup{XK_KP_Enter} = $KEY_KPENTER;
$key_lookup{XK_Control_R} = $KEY_RIGHTCTRL;
$key_lookup{XK_KP_Divide} = $KEY_KPSLASH;
$key_lookup{XK_Sys_Req} = $KEY_SYSRQ;
$key_lookup{XK_Alt_R} = $KEY_RIGHTALT;
$key_lookup{XK_Linefeed} = $KEY_LINEFEED;
$key_lookup{XK_Home} = $KEY_HOME;
$key_lookup{XK_Up} = $KEY_UP;
$key_lookup{XK_Page_Up} = $KEY_PAGEUP;
$key_lookup{XK_Left} = $KEY_LEFT;
$key_lookup{XK_Right} = $KEY_RIGHT;
$key_lookup{XK_End} = $KEY_END;
$key_lookup{XK_Down} = $KEY_DOWN;
$key_lookup{XK_Page_Down} = $KEY_PAGEDOWN;
$key_lookup{XK_Insert} = $KEY_INSERT;
$key_lookup{XK_Delete} = $KEY_DELETE;
$key_lookup{XK_KP_Equal} = $KEY_KPEQUAL;
$key_lookup{XK_Pause} = $KEY_PAUSE;
$key_lookup{XK_F21} = $KEY_F21;
$key_lookup{XK_F22} = $KEY_F22;
$key_lookup{XK_F23} = $KEY_F23;
$key_lookup{XK_F24} = $KEY_F24;
$key_lookup{XK_KP_Separator} = $KEY_KPCOMMA;
$key_lookup{XK_Meta_L} = $KEY_LEFTMETA;
$key_lookup{XK_Meta_R} = $KEY_RIGHTMETA;
$key_lookup{XK_Multi_key} = $KEY_COMPOSE;
$ABS_MAX = 63;
$UI_DEV_CREATE = 0x5501;
$UI_DEV_DESTROY = 0x5502;
$UI_SET_EVBIT = 0x40045564;
$UI_SET_KEYBIT = 0x40045565;
$UI_SET_RELBIT = 0x40045566;
$UI_SET_ABSBIT = 0x40045567;
# FIXME: time hires, etc.
$linux_gettimeofday_syscall = 78;
$O_RDONLY = 00;
$O_WRONLY = 01;
$O_RDWR = 02;
$O_NDELAY = 04000;
}

@ -620,24 +620,24 @@ static void pipe_pointer(int mask, int x, int y, rfbClientPtr client) {
if (mask == button_mask) {
strcat(hint, "None");
} else {
int i, old, new, m = 1, cnt = 0;
int i, old, newb, m = 1, cnt = 0;
for (i=0; i<MAX_BUTTONS; i++) {
char s[20];
old = button_mask & m;
new = mask & m;
newb = mask & m;
m = m << 1;
if (old == new) {
if (old == newb) {
continue;
}
if (hint[0] != '\0') {
strcat(hint, ",");
}
if (new && ! old) {
if (newb && ! old) {
sprintf(s, "ButtonPress-%d", i+1);
cnt++;
} else if (! new && old) {
} else if (! newb && old) {
sprintf(s, "ButtonRelease-%d", i+1);
cnt++;
}

@ -74,8 +74,8 @@ char *process_remote_cmd(char *cmd, int stringonly);
static char *add_item(char *instr, char *item);
static char *delete_item(char *instr, char *item);
static void if_8bpp_do_new_fb(void);
static void reset_httpport(int old, int new);
static void reset_rfbport(int old, int new) ;
static void reset_httpport(int old, int newp);
static void reset_rfbport(int old, int newp) ;
char *query_result = NULL;
@ -563,8 +563,8 @@ void http_connections(int on) {
}
}
static void reset_httpport(int old, int new) {
int hp = new;
static void reset_httpport(int old, int newp) {
int hp = newp;
if (! screen->httpDir) {
return;
@ -619,8 +619,8 @@ static void reset_httpport(int old, int new) {
}
}
static void reset_rfbport(int old, int new) {
int rp = new;
static void reset_rfbport(int old, int newp) {
int rp = newp;
if (inetd) {
rfbLog("reset_rfbport: cannot set rfbport: %d in inetd.\n", rp);
@ -2303,7 +2303,7 @@ char *process_remote_cmd(char *cmd, int stringonly) {
* safe_remote_only but at least the command names
* are fixed.
*/
char *new;
char *newc;
int doit = 1;
COLON_CHECK("solid_color:")
if (query) {
@ -2313,19 +2313,19 @@ char *process_remote_cmd(char *cmd, int stringonly) {
}
p += strlen("solid_color:");
if (*p != '\0') {
new = strdup(p);
newc = strdup(p);
} else {
new = strdup(solid_default);
newc = strdup(solid_default);
}
rfbLog("remote_cmd: solid %s -> %s\n", NONUL(solid_str), new);
rfbLog("remote_cmd: solid %s -> %s\n", NONUL(solid_str), newc);
if (solid_str) {
if (!strcmp(solid_str, new)) {
if (!strcmp(solid_str, newc)) {
doit = 0;
}
free(solid_str);
}
solid_str = new;
solid_str = newc;
use_solid_bg = 1;
if (raw_fb && !macosx_console) set_raw_fb_params(0);
@ -4213,6 +4213,24 @@ char *process_remote_cmd(char *cmd, int stringonly) {
rfbLog("enabled grab_ptr\n");
goto done;
}
if (!strcmp(p, "ungrabboth")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, ungrab_both);
goto qry;
}
ungrab_both = 1;
rfbLog("enabled ungrab_both\n");
goto done;
}
if (!strcmp(p, "noungrabboth")) {
if (query) {
snprintf(buf, bufn, "ans=%s:%d", p, !ungrab_both);
goto qry;
}
ungrab_both = 0;
rfbLog("disabled ungrab_both\n");
goto done;
}
if (!strcmp(p, "nograbptr")) {
int orig = grab_ptr;
if (query) {

@ -2961,7 +2961,17 @@ static void nap_check(int tile_cnt) {
now = time(NULL);
if (screen_blank > 0) {
int dt_ev, dt_fbu, ms = 2000;
int dt_ev, dt_fbu;
static int ms = 0;
if (ms == 0) {
ms = 2000;
if (getenv("X11VNC_SB_FACTOR")) {
ms = ms * atof(getenv("X11VNC_SB_FACTOR"));
}
if (ms <= 0) {
ms = 2000;
}
}
/* if no activity, pause here for a second or so. */
dt_ev = (int) (now - last_event);

@ -1461,7 +1461,19 @@ char *vnc_reflect_guess(char *str, char **raw_fb_addr) {
char *str0 = strdup(str);
if (client == NULL) {
client = rfbGetClient(8, 3, 4);
int bitsPerSample = 8;
int samplesPerPixel = 3;
int bytesPerPixel = 4;
char *s;
s = getenv("X11VNC_REFLECT_bitsPerSample");
if (s) bitsPerSample = atoi(s);
s = getenv("X11VNC_REFLECT_samplesPerPixel");
if (s) samplesPerPixel = atoi(s);
s = getenv("X11VNC_REFLECT_bytesPerPixel");
if (s) bytesPerPixel = atoi(s);
rfbLog("rfbGetClient(bitsPerSample=%d, samplesPerPixel=%d, bytesPerPixel=%d)\n",
bitsPerSample, samplesPerPixel, bytesPerPixel);
client = rfbGetClient(bitsPerSample, samplesPerPixel, bytesPerPixel);
}
rfbLog("rawfb: %s\n", str);
@ -2086,16 +2098,16 @@ if (db) fprintf(stderr, "initialize_raw_fb reset\n");
/* hmmm, not following directions, see if map: applies */
struct stat sbuf;
if (stat(str, &sbuf) == 0) {
char *new;
char *newstr;
int len = strlen("map:") + strlen(str) + 1;
rfbLog("no type prefix: %s\n", raw_fb_str);
rfbLog(" but file exists, so assuming: map:%s\n",
raw_fb_str);
new = (char *) malloc(len);
strcpy(new, "map:");
strcat(new, str);
newstr = (char *) malloc(len);
strcpy(newstr, "map:");
strcat(newstr, str);
free(str);
str = new;
str = newstr;
}
}

@ -125,17 +125,17 @@ char *get_saved_pem(char *save, int create) {
sprintf(path, "%s/server%s.pem", cdir, s);
if (stat(path, &sbuf) != 0) {
char *new = NULL;
char *new_name = NULL;
if (create) {
if (inetd || opts_bg) {
set_env("GENCERT_NOPROMPT", "1");
}
new = create_tmp_pem(path, prompt);
new_name = create_tmp_pem(path, prompt);
if (!getenv("X11VNC_SSL_NO_PASSPHRASE") && !inetd && !opts_bg) {
sslEncKey(new, 0);
sslEncKey(new_name, 0);
}
}
return new;
return new_name;
}
if (! quiet) {
@ -332,9 +332,12 @@ char *create_tmp_pem(char *pathin, int prompt) {
sprintf(str, tmpl, C, L, OU, O, CN, EM);
cnf_fd = mkstemp(cnf);
if (cnf_fd < 0) {
return NULL;
}
pem_fd = mkstemp(pem);
if (cnf_fd < 0 || pem_fd < 0) {
if (pem_fd < 0) {
close(cnf_fd);
return NULL;
}

@ -847,15 +847,18 @@ char find_display[] =
"prdpy () {\n"
" d1=$1\n"
" chvt0=\"\"\n"
" if [ \"X$FIND_DISPLAY_NO_VT_FIND\" != \"X\" ]; then\n"
" :\n"
" # we can only do chvt on Linux:\n"
" if [ \"X$uname\" = \"XLinux\" ]; then\n"
" elif [ \"X$uname\" = \"XLinux\" ]; then\n"
" d2=$d1\n"
" d3=`echo \"$d2\" | sed -e 's/^.*:/:/' -e 's/\\..*$//'`\n"
" d4=\"($d2|$d3)\"\n"
"\n"
" # vt is usually in X server line:\n"
" #\n"
" vt=`ps wwwwwaux | grep X | egrep -v 'startx|xinit' | egrep \" $d4 \" | egrep ' vt([789]|[1-9][0-9][0-9]*) ' | grep -v grep | head -n 1`\n"
" ps_tmp=`ps wwaux | grep X`\n"
" vt=`echo \"$ps_tmp\" | grep X | egrep -v 'startx|xinit' | egrep \" $d4 \" | egrep ' vt([789]|[1-9][0-9][0-9]*) ' | grep -v grep | head -n 1`\n"
"\n"
" if [ \"X$vt\" != \"X\" ]; then\n"
" # strip it out and add it.\n"
@ -865,7 +868,7 @@ char find_display[] =
" fi\n"
" else\n"
" # otherwise look for tty:\n"
" vt=`ps wwwwwaux | grep X | egrep \" $d4 \" | egrep ' tty([789]|[1-9][0-9][0-9]*) ' | grep -v grep | head -n 1`\n"
" vt=`echo \"$ps_tmp\" | grep X | egrep \" $d4 \" | egrep ' tty([789]|[1-9][0-9][0-9]*) ' | grep -v grep | head -n 1`\n"
" if [ \"X$vt\" != \"X\" ]; then\n"
" vt=`echo \"$vt\" | sed -e 's/^.* tty\\([0-9][0-9]*\\) .*$/\\1/'`\n"
" if echo \"$vt\" | grep '^[0-9][0-9]*$' > /dev/null; then\n"
@ -873,8 +876,12 @@ char find_display[] =
" fi\n"
" else\n"
" # otherwise try lsof:\n"
" pvt=`ps wwwwwaux | grep X | egrep -v 'startx|xinit' | egrep \" $d4 \" | head -n 1 | awk '{print $2}'`\n"
" if [ \"X$pvt\" != \"X\" ]; then\n"
" pvt=`echo \"$ps_tmp\" | grep X | egrep -v 'startx|xinit' | egrep \" $d4 \" | head -n 1 | awk '{print $2}'`\n"
" if [ \"X$FIND_DISPLAY_NO_LSOF\" != \"X\" ]; then\n"
" if [ \"X$pvt\" != \"X\" ]; then\n"
" chvt0=\",XPID=$pvt\"\n"
" fi\n"
" elif [ \"X$pvt\" != \"X\" ]; then\n"
" vt=`lsof -b -p \"$pvt\" 2>/dev/null | egrep '/dev/tty([789]|[1-9][0-9][0-9]*)$' | grep -v grep | head -n 1 | awk '{print $NF}' | sed -e 's,/dev/tty,,'`\n"
" if echo \"$vt\" | grep '^[0-9][0-9]*$' > /dev/null; then\n"
" chvt0=\",VT=$vt\"\n"
@ -902,9 +909,9 @@ char find_display[] =
"if [ \"X$uname\" = \"XDarwin\" ]; then\n"
" psout=`ps aux 2>/dev/null | grep -wv PID | grep -v grep`\n"
"elif [ \"X$uname\" = \"XLinux\" -o \"X$is_bsd\" = \"X1\" ]; then\n"
" psout=`ps wwwaux 2>/dev/null | grep -wv PID | grep -v grep`\n"
" psout=`ps wwaux 2>/dev/null | grep -wv PID | grep -v grep`\n"
"elif [ \"X$uname\" = \"XSunOS\" -a -x /usr/ucb/ps ]; then\n"
" psout=`/usr/ucb/ps wwwaux 2>/dev/null | grep -wv PID | grep -v grep`\n"
" psout=`/usr/ucb/ps wwaux 2>/dev/null | grep -wv PID | grep -v grep`\n"
"else\n"
" psout=`ps -ef 2>/dev/null | grep -wv PID | grep -v grep`\n"
"fi\n"
@ -1192,6 +1199,8 @@ char find_display[] =
"\n"
"# try the items in the list:\n"
"#\n"
"nsout_trim=`echo \"$nsout\" | grep \"/tmp/.X11-unix/\"`\n"
"#\n"
"for p in $list\n"
"do\n"
" xa=`echo \"$p\" | awk -F, '{print $2}'`\n"
@ -1205,7 +1214,7 @@ char find_display[] =
" # check for the local X11 files:\n"
" xd=\"/tmp/.X11-unix/X$d\"\n"
" if [ -r \"$xd\" -o -w \"$xd\" -o -x \"$xd\" ]; then\n"
" if echo \"$nsout\" | grep \"/tmp/.X11-unix/X$d[ ]*\\$\" > /dev/null; then\n"
" if echo \"$nsout_trim\" | grep \"/tmp/.X11-unix/X$d[ ]*\\$\" > /dev/null; then\n"
" ok=1\n"
" fi\n"
" fi\n"
@ -1473,6 +1482,7 @@ char create_display[] =
"COLUMNS=256\n"
"export COLUMNS\n"
"\n"
"LC_ALL_save=$LC_ALL\n"
"LC_ALL=C\n"
"export LC_ALL\n"
"\n"
@ -1491,11 +1501,12 @@ char create_display[] =
" if [ \"X$have_netstat\" != \"X\" ]; then\n"
" nsout=`$have_netstat -an`\n"
" fi\n"
" nsout_trim=`echo \"$nsout\" | grep \"/tmp/.X11-unix/\"`\n"
" while [ $try -lt $sry ]\n"
" do\n"
" tlock=\"/tmp/.X${try}-lock\"\n"
" if [ -r $tlock ]; then\n"
" if echo \"$nsout\" | grep \"/tmp/.X11-unix/X${try}[ ]*\\$\" > /dev/null; then\n"
" if echo \"$nsout_trim\" | grep \"/tmp/.X11-unix/X${try}[ ]*\\$\" > /dev/null; then\n"
" :\n"
" else\n"
" pid=`head -n 1 $tlock 2>/dev/null | sed -e 's/[ ]//g' | grep '^[0-9][0-9]*$'`\n"
@ -1513,7 +1524,7 @@ char create_display[] =
" fi\n"
" fi\n"
" if [ ! -f $tlock ]; then\n"
" if echo \"$nsout\" | grep \"/tmp/.X11-unix/X${try}[ ]*\\$\" > /dev/null; then\n"
" if echo \"$nsout_trim\" | grep \"/tmp/.X11-unix/X${try}[ ]*\\$\" > /dev/null; then\n"
" :\n"
" else\n"
" n=$try\n"
@ -1829,6 +1840,16 @@ char create_display[] =
" echo \"\" 1>&2\n"
"}\n"
"\n"
"put_back_LC_ALL() {\n"
" if [ \"X$X11VNC_CREATE_LC_ALL_C_OK\" = \"X\" ]; then\n"
" if [ \"X$LC_ALL_save\" = \"X\" ]; then\n"
" unset LC_ALL\n"
" else\n"
" LC_ALL=\"$LC_ALL_save\"\n"
" fi\n"
" fi\n"
"}\n"
"\n"
"server() {\n"
" authfile=`auth`\n"
" sess=`findsession`\n"
@ -1894,6 +1915,7 @@ char create_display[] =
" # ns=2\n"
" #fi\n"
"\n"
"\n"
" if [ \"X$use_xdmcp_query\" = \"X1\" ]; then\n"
" # we cannot use -nolisten tcp\n"
" if [ \"X$FD_XDMCP_IF\" != \"X\" ]; then\n"
@ -1908,6 +1930,7 @@ char create_display[] =
" lhost=localhost\n"
" fi\n"
" echo \"$* -once -query $lhost $FD_OPTS\" 1>&2\n"
" put_back_LC_ALL\n"
" if [ \"X$have_root\" != \"X\" ]; then\n"
" if [ -r $authfile ]; then\n"
" $have_nohup $* -once -query $lhost -auth $authfile $FD_OPTS 1>&2 &\n"
@ -1932,6 +1955,7 @@ char create_display[] =
" sxcmd=$have_startx\n"
" fi\n"
" echo \"$sxcmd $sess -- $* $nolisten -auth $authfile $FD_OPTS\" 1>&2\n"
" put_back_LC_ALL\n"
" if [ \"X$have_root\" != \"X\" ]; then\n"
" $sxcmd $sess -- $* $nolisten -auth $authfile $FD_OPTS 1>&2 &\n"
" else\n"
@ -1947,6 +1971,7 @@ char create_display[] =
" else\n"
" # need to emulate startx/xinit ourselves...\n"
" echo \"$* $nolisten -auth $authfile $FD_OPTS\" 1>&2\n"
" put_back_LC_ALL\n"
" if [ \"X$have_root\" != \"X\" ]; then\n"
" $have_nohup $* $nolisten -auth $authfile $FD_OPTS 1>&2 &\n"
" pid=$!\n"
@ -1964,10 +1989,14 @@ char create_display[] =
" $have_nohup sh -c \"(sleep 3; $sess)\" 1>&2 &\n"
" fi\n"
" fi\n"
"\n"
" LC_ALL=C\n"
" export LC_ALL\n"
"\n"
" if uname | grep SunOS > /dev/null; then\n"
" $have_nohup sh -c \"(sleep 60; rm -f $rmf)\" 1>&2 &\n"
" $have_nohup sh -c \"(sleep 150; rm -f $rmf)\" 1>&2 &\n"
" else\n"
" $have_nohup sh -c \"(sleep 60; rm -f $rmf $authfile)\" 1>&2 &\n"
" $have_nohup sh -c \"(sleep 150; rm -f $rmf $authfile)\" 1>&2 &\n"
" fi\n"
"\n"
" t=0\n"

@ -63,6 +63,7 @@ so, delete this exception statement from your version.
int check_uinput(void);
int initialize_uinput(void);
void shutdown_uinput(void);
int set_uinput_accel(char *str);
int set_uinput_thresh(char *str);
void set_uinput_reset(int ms);
@ -83,20 +84,29 @@ static void init_key_tracker(void);
static int mod_is_down(void);
static int key_is_down(void);
static void set_uinput_accel_xy(double fx, double fy);
static void shutdown_uinput(void);
static void ptr_move(int dx, int dy);
static void ptr_rel(int dx, int dy);
static void button_click(int down, int btn);
static int lookup_code(int keysym);
static int fd = -1;
static int db = 0;
static int direct_rel_fd = -1;
static int direct_abs_fd = -1;
static int direct_btn_fd = -1;
static int direct_key_fd = -1;
static int bmask = 0;
static int db = 0;
static char *injectable = NULL;
static char *uinput_dev = NULL;
static char *tslib_cal = NULL;
static double a[7];
static int uinput_touchscreen = 0;
static int uinput_abs = 0;
static int btn_touch = 0;
static int dragskip = 0;
static int touch_always = 0;
static int touch_pressure = 1;
static int abs_x = 0, abs_y = 0;
static char *devs[] = {
@ -106,6 +116,13 @@ static char *devs[] = {
NULL
};
#ifndef O_NDELAY
#ifdef O_NONBLOCK
#define O_NDELAY O_NONBLOCK
#else
#define O_NDELAY 0
#endif
#endif
/*
* User may need to do:
@ -137,7 +154,7 @@ int check_uinput(void) {
fd = -1;
i = 0;
while (devs[i] != NULL) {
if ( (fd = open(devs[i++], O_RDWR)) >= 0) {
if ( (fd = open(devs[i++], O_WRONLY | O_NDELAY)) >= 0) {
break;
}
}
@ -190,39 +207,187 @@ static int key_is_down(void) {
return 0;
}
static void shutdown_uinput(void) {
void shutdown_uinput(void) {
#ifdef UINPUT_OK
ioctl(fd, UI_DEV_DESTROY);
if (fd >= 0) {
if (db) {
rfbLog("shutdown_uinput called on fd=%d\n", fd);
}
ioctl(fd, UI_DEV_DESTROY);
close(fd);
fd = -1;
}
/* close direct injection files too: */
if (direct_rel_fd >= 0) close(direct_rel_fd);
if (direct_abs_fd >= 0) close(direct_abs_fd);
if (direct_btn_fd >= 0) close(direct_btn_fd);
if (direct_key_fd >= 0) close(direct_key_fd);
direct_rel_fd = -1;
direct_abs_fd = -1;
direct_btn_fd = -1;
direct_key_fd = -1;
#endif
}
/*
grep BUS_ /usr/include/linux/input.h | awk '{print $2}' | perl -e 'while (<>) {chomp; print "#ifdef $_\n\t\tif(!strcmp(s, \"$_\"))\tudev.id.bustype = $_\n#endif\n"}'
*/
static int get_bustype(char *s) {
#ifdef UINPUT_OK
if (!s) return 0;
#ifdef BUS_PCI
if(!strcmp(s, "BUS_PCI")) return BUS_PCI;
#endif
#ifdef BUS_ISAPNP
if(!strcmp(s, "BUS_ISAPNP")) return BUS_ISAPNP;
#endif
#ifdef BUS_USB
if(!strcmp(s, "BUS_USB")) return BUS_USB;
#endif
#ifdef BUS_HIL
if(!strcmp(s, "BUS_HIL")) return BUS_HIL;
#endif
#ifdef BUS_BLUETOOTH
if(!strcmp(s, "BUS_BLUETOOTH")) return BUS_BLUETOOTH;
#endif
#ifdef BUS_VIRTUAL
if(!strcmp(s, "BUS_VIRTUAL")) return BUS_VIRTUAL;
#endif
#ifdef BUS_ISA
if(!strcmp(s, "BUS_ISA")) return BUS_ISA;
#endif
#ifdef BUS_I8042
if(!strcmp(s, "BUS_I8042")) return BUS_I8042;
#endif
#ifdef BUS_XTKBD
if(!strcmp(s, "BUS_XTKBD")) return BUS_XTKBD;
#endif
#ifdef BUS_RS232
if(!strcmp(s, "BUS_RS232")) return BUS_RS232;
#endif
#ifdef BUS_GAMEPORT
if(!strcmp(s, "BUS_GAMEPORT")) return BUS_GAMEPORT;
#endif
#ifdef BUS_PARPORT
if(!strcmp(s, "BUS_PARPORT")) return BUS_PARPORT;
#endif
#ifdef BUS_AMIGA
if(!strcmp(s, "BUS_AMIGA")) return BUS_AMIGA;
#endif
#ifdef BUS_ADB
if(!strcmp(s, "BUS_ADB")) return BUS_ADB;
#endif
#ifdef BUS_I2C
if(!strcmp(s, "BUS_I2C")) return BUS_I2C;
#endif
#ifdef BUS_HOST
if(!strcmp(s, "BUS_HOST")) return BUS_HOST;
#endif
#ifdef BUS_GSC
if(!strcmp(s, "BUS_GSC")) return BUS_GSC;
#endif
#ifdef BUS_ATARI
if(!strcmp(s, "BUS_ATARI")) return BUS_ATARI;
#endif
if (atoi(s) > 0) {
return atoi(s);
}
#endif
return 0;
}
static void load_tslib_cal(void) {
FILE *f;
char line[1024], *p;
int i;
/* /etc/pointercal -528 33408 -3417516 -44200 408 40292028 56541 */
/* this is the identity transformation: */
a[0] = 1.0;
a[1] = 0.0;
a[2] = 0.0;
a[3] = 0.0;
a[4] = 1.0;
a[5] = 0.0;
a[6] = 1.0;
if (tslib_cal == NULL) {
return;
}
rfbLog("load_tslib_cal: reading %s\n", tslib_cal);
f = fopen(tslib_cal, "r");
if (f == NULL) {
rfbLogPerror("load_tslib_cal: fopen");
clean_up_exit(1);
}
if (fgets(line, sizeof(line), f) == NULL) {
rfbLogPerror("load_tslib_cal: fgets");
clean_up_exit(1);
}
fclose(f);
p = strtok(line, " \t");
i = 0;
while (p) {
a[i] = (double) atoi(p);
rfbLog("load_tslib_cal: a[%d] %.3f\n", i, a[i]);
p = strtok(NULL, " \t");
i++;
if (i >= 7) {
break;
}
}
if (i != 7) {
rfbLog("load_tslib_cal: invalid tslib file format: i=%d %s\n",
i, tslib_cal);
clean_up_exit(1);
}
}
int initialize_uinput(void) {
#ifndef UINPUT_OK
return 0;
#else
int i;
char *s;
struct uinput_user_dev udev;
if (fd >= 0) {
shutdown_uinput();
close(fd);
fd = -1;
}
fd = -1;
if (getenv("X11VNC_UINPUT_DEBUG")) {
db = atoi(getenv("X11VNC_UINPUT_DEBUG"));
rfbLog("set uinput debug to: %d\n", db);
}
if (tslib_cal) {
load_tslib_cal();
}
init_key_tracker();
if (uinput_dev) {
fd = open(uinput_dev, O_RDWR);
rfbLog("initialize_uinput: using: %s %d\n", uinput_dev, fd);
if (!strcmp(uinput_dev, "nouinput")) {
rfbLog("initialize_uinput: not creating uinput device.\n");
return 1;
} else {
fd = open(uinput_dev, O_WRONLY | O_NDELAY);
rfbLog("initialize_uinput: using: %s %d\n", uinput_dev, fd);
}
} else {
i = 0;
while (devs[i] != NULL) {
if ( (fd = open(devs[i], O_RDWR)) >= 0) {
if ( (fd = open(devs[i], O_WRONLY | O_NDELAY)) >= 0) {
rfbLog("initialize_uinput: using: %s %d\n",
devs[i], fd);
break;
@ -233,15 +398,29 @@ int initialize_uinput(void) {
if (fd < 0) {
rfbLog("initialize_uinput: could not open an uinput device.\n");
rfbLogPerror("open");
clean_up_exit(1);
if (direct_rel_fd < 0 && direct_abs_fd < 0 && direct_btn_fd < 0 && direct_key_fd < 0) {
clean_up_exit(1);
}
return 1;
}
memset(&udev, 0, sizeof(udev));
strncpy(udev.name, "x11vnc injector", UINPUT_MAX_NAME_SIZE);
udev.id.bustype = BUS_USB; /* Matters? */
udev.id.version = 4;
s = getenv("X11VNC_UINPUT_BUS");
if (s) {
udev.id.bustype = get_bustype(s);
} else if (0) {
udev.id.bustype = BUS_USB;
}
s = getenv("X11VNC_UINPUT_VERSION");
if (s) {
udev.id.version = atoi(s);
} else if (0) {
udev.id.version = 4;
}
ioctl(fd, UI_SET_EVBIT, EV_REL);
ioctl(fd, UI_SET_RELBIT, REL_X);
@ -249,6 +428,8 @@ int initialize_uinput(void) {
ioctl(fd, UI_SET_EVBIT, EV_KEY);
ioctl(fd, UI_SET_EVBIT, EV_SYN);
for (i=0; i < 256; i++) {
ioctl(fd, UI_SET_KEYBIT, i);
}
@ -289,6 +470,23 @@ int initialize_uinput(void) {
set_uinput_accel_xy(1.0, 1.0);
}
if (db) {
rfbLog(" udev.name: %s\n", udev.name);
rfbLog(" udev.id.bustype: %d\n", udev.id.bustype);
rfbLog(" udev.id.vendor: %d\n", udev.id.vendor);
rfbLog(" udev.id.product: %d\n", udev.id.product);
rfbLog(" udev.id.version: %d\n", udev.id.version);
rfbLog(" udev.ff_effects_max: %d\n", udev.ff_effects_max);
rfbLog(" udev.absmin[ABS_X]: %d\n", udev.absmin[ABS_X]);
rfbLog(" udev.absmax[ABS_X]: %d\n", udev.absmax[ABS_X]);
rfbLog(" udev.absfuzz[ABS_X]: %d\n", udev.absfuzz[ABS_X]);
rfbLog(" udev.absflat[ABS_X]: %d\n", udev.absflat[ABS_X]);
rfbLog(" udev.absmin[ABS_Y]: %d\n", udev.absmin[ABS_Y]);
rfbLog(" udev.absmax[ABS_Y]: %d\n", udev.absmax[ABS_Y]);
rfbLog(" udev.absfuzz[ABS_Y]: %d\n", udev.absfuzz[ABS_Y]);
rfbLog(" udev.absflat[ABS_Y]: %d\n", udev.absflat[ABS_Y]);
}
write(fd, &udev, sizeof(udev));
if (ioctl(fd, UI_DEV_CREATE) != 0) {
@ -408,6 +606,11 @@ void parse_uinput_str(char *in) {
uinput_abs = 0;
abs_x = abs_y = 0;
if (tslib_cal) {
free(tslib_cal);
tslib_cal = NULL;
}
p = strtok(str, ",");
while (p) {
if (p[0] == '/') {
@ -415,6 +618,11 @@ void parse_uinput_str(char *in) {
free(uinput_dev);
}
uinput_dev = strdup(p);
} else if (strstr(p, "nouinput") == p) {
if (uinput_dev) {
free(uinput_dev);
}
uinput_dev = strdup(p);
} else if (strstr(p, "accel=") == p) {
q = p + strlen("accel=");
if (! set_uinput_accel(q)) {
@ -435,6 +643,12 @@ void parse_uinput_str(char *in) {
free(injectable);
}
injectable = strdup(p);
} else if (strstr(p, "touch_always=") == p) {
touch_always = atoi(p + strlen("touch_always="));
} else if (strstr(p, "btn_touch=") == p) {
btn_touch = atoi(p + strlen("btn_touch="));
} else if (strstr(p, "dragskip=") == p) {
dragskip = atoi(p + strlen("dragskip="));
} else if (strstr(p, "touch") == p) {
int gw, gh;
q = strchr(p, '=');
@ -452,7 +666,38 @@ void parse_uinput_str(char *in) {
abs_x = gw;
abs_y = gh;
}
} else if (strstr(p, "pressure=") == p) {
touch_pressure = atoi(p + strlen("pressure="));
} else if (strstr(p, "direct_rel=") == p) {
direct_rel_fd = open(p+strlen("direct_rel="), O_WRONLY);
if (direct_rel_fd < 0) {
rfbLogPerror("uinput: direct_rel open");
} else {
rfbLog("uinput: opened: %s fd=%d\n", p, direct_rel_fd);
}
} else if (strstr(p, "direct_abs=") == p) {
direct_abs_fd = open(p+strlen("direct_abs="), O_WRONLY);
if (direct_abs_fd < 0) {
rfbLogPerror("uinput: direct_abs open");
} else {
rfbLog("uinput: opened: %s fd=%d\n", p, direct_abs_fd);
}
} else if (strstr(p, "direct_btn=") == p) {
direct_btn_fd = open(p+strlen("direct_btn="), O_WRONLY);
if (direct_btn_fd < 0) {
rfbLogPerror("uinput: direct_btn open");
} else {
rfbLog("uinput: opened: %s fd=%d\n", p, direct_btn_fd);
}
} else if (strstr(p, "direct_key=") == p) {
direct_key_fd = open(p+strlen("direct_key="), O_WRONLY);
if (direct_key_fd < 0) {
rfbLogPerror("uinput: direct_key open");
} else {
rfbLog("uinput: opened: %s fd=%d\n", p, direct_key_fd);
}
} else if (strstr(p, "tslib_cal=") == p) {
tslib_cal = strdup(p+strlen("tslib_cal="));
} else {
rfbLog("invalid UINPUT option: %s\n", p);
clean_up_exit(1);
@ -465,6 +710,7 @@ void parse_uinput_str(char *in) {
static void ptr_move(int dx, int dy) {
#ifdef UINPUT_OK
struct input_event ev;
int d = direct_rel_fd < 0 ? fd : direct_rel_fd;
if (injectable && strchr(injectable, 'M') == NULL) {
return;
@ -472,29 +718,45 @@ static void ptr_move(int dx, int dy) {
memset(&ev, 0, sizeof(ev));
if (db) fprintf(stderr, "ptr_move(%d, %d) fd=%d\n", dx, dy, d);
gettimeofday(&ev.time, NULL);
ev.type = EV_REL;
ev.code = REL_Y;
ev.value = dy;
write(fd, &ev, sizeof(ev));
write(d, &ev, sizeof(ev));
ev.type = EV_REL;
ev.code = REL_X;
ev.value = dx;
write(fd, &ev, sizeof(ev));
write(d, &ev, sizeof(ev));
ev.type = EV_SYN;
ev.code = SYN_REPORT;
ev.value = 0;
write(fd, &ev, sizeof(ev));
write(d, &ev, sizeof(ev));
#else
if (!dx || !dy) {}
#endif
}
static void ptr_abs(int x, int y) {
static void apply_tslib(int *x, int *y) {
double x1 = *x, y1 = *y, x2, y2;
/* this is the inverse of the tslib linear transform: */
x2 = (a[4] * (a[6] * x1 - a[2]) - a[1] * (a[6] * y1 - a[5]))/(a[4]*a[0] - a[1]*a[3]);
y2 = (a[0] * (a[6] * y1 - a[5]) - a[3] * (a[6] * x1 - a[2]))/(a[4]*a[0] - a[1]*a[3]);
*x = (int) x2;
*y = (int) y2;
}
static void ptr_abs(int x, int y, int p) {
#ifdef UINPUT_OK
struct input_event ev;
int x0, y0;
int d = direct_abs_fd < 0 ? fd : direct_abs_fd;
if (injectable && strchr(injectable, 'M') == NULL) {
return;
@ -502,23 +764,37 @@ static void ptr_abs(int x, int y) {
memset(&ev, 0, sizeof(ev));
if (db) fprintf(stderr, "ptr_abs(%d, %d)\n", x, y);
x0 = x;
y0 = y;
if (tslib_cal) {
apply_tslib(&x, &y);
}
if (db) fprintf(stderr, "ptr_abs(%d, %d => %d %d, p=%d) fd=%d\n", x0, y0, x, y, p, d);
gettimeofday(&ev.time, NULL);
ev.type = EV_ABS;
ev.code = ABS_Y;
ev.value = y;
write(fd, &ev, sizeof(ev));
write(d, &ev, sizeof(ev));
ev.type = EV_ABS;
ev.code = ABS_X;
ev.value = x;
write(fd, &ev, sizeof(ev));
write(d, &ev, sizeof(ev));
if (p >= 0) {
ev.type = EV_ABS;
ev.code = ABS_PRESSURE;
ev.value = p;
write(d, &ev, sizeof(ev));
}
ev.type = EV_SYN;
ev.code = SYN_REPORT;
ev.value = 0;
write(fd, &ev, sizeof(ev));
write(d, &ev, sizeof(ev));
#else
if (!x || !y) {}
#endif
@ -658,7 +934,7 @@ static void ptr_rel(int dx, int dy) {
resid_y -= dyf;
if (db > 1) fprintf(stderr, "*%s resid: dx dy: %d %d %f %f\n", accel > 1 ? "*" : " ", dxf, dyf, resid_x, resid_y);
if (0) {usleep(100*1000)};
if (0) {usleep(100*1000) ;}
ptr_move(dxf, dyf);
}
}
@ -667,12 +943,13 @@ if (0) {usleep(100*1000)};
static void button_click(int down, int btn) {
#ifdef UINPUT_OK
struct input_event ev;
int d = direct_btn_fd < 0 ? fd : direct_btn_fd;
if (injectable && strchr(injectable, 'B') == NULL) {
return;
}
if (db) fprintf(stderr, "button_click: btn %d %s\n", btn, down ? "down" : "up");
if (db) fprintf(stderr, "button_click: btn %d %s fd=%d\n", btn, down ? "down" : "up", d);
memset(&ev, 0, sizeof(ev));
gettimeofday(&ev.time, NULL);
@ -696,12 +973,12 @@ static void button_click(int down, int btn) {
return;
}
write(fd, &ev, sizeof(ev));
write(d, &ev, sizeof(ev));
ev.type = EV_SYN;
ev.code = SYN_REPORT;
ev.value = 0;
write(fd, &ev, sizeof(ev));
write(d, &ev, sizeof(ev));
last_button_click = dnow();
#else
@ -756,15 +1033,6 @@ void uinput_pointer_command(int mask, int x, int y, rfbClientPtr client) {
do_reset = 1;
}
if (uinput_abs) {
#if 0
/* this is a bad idea... need to do something else */
if (do_reset) {
ptr_abs(dpy_x, dpy_y);
usleep(10*1000);
ptr_abs(x, y);
usleep(10*1000);
}
#endif
do_reset = 0;
}
@ -849,7 +1117,7 @@ void uinput_pointer_command(int mask, int x, int y, rfbClientPtr client) {
} else {
ptr_rel(x, y);
}
if (1) {usleep(10*1000)};
if (1) {usleep(10*1000) ;}
last_x = x;
last_y = y;
@ -863,8 +1131,10 @@ void uinput_pointer_command(int mask, int x, int y, rfbClientPtr client) {
if (input.motion) {
if (x != last_x || y != last_y) {
if (uinput_abs) {
ptr_abs(x, y);
if (uinput_touchscreen) {
;
} else if (uinput_abs) {
ptr_abs(x, y, -1);
} else {
ptr_rel(x - last_x, y - last_y);
}
@ -888,7 +1158,46 @@ void uinput_pointer_command(int mask, int x, int y, rfbClientPtr client) {
fprintf(stderr, "button_mask: %s\n", bitprint(button_mask, 16));
}
if (mask != last_mask) {
if (uinput_touchscreen) {
if (!btn_touch) {
static int down_count = 0;
int p = touch_pressure >=0 ? touch_pressure : 0;
if (!last_mask && !mask) {
if (touch_always) {
ptr_abs(last_x, last_y, 0);
}
} else if (!last_mask && mask) {
ptr_abs(last_x, last_y, p);
down_count = 0;
} else if (last_mask && !mask) {
ptr_abs(last_x, last_y, 0);
} else if (last_mask && mask) {
down_count++;
if (dragskip > 0) {
if (down_count % dragskip == 0) {
ptr_abs(last_x, last_y, p);
}
} else {
ptr_abs(last_x, last_y, p);
}
}
} else {
if (!last_mask && !mask) {
if (touch_always) {
ptr_abs(last_x, last_y, 0);
}
} else if (!last_mask && mask) {
ptr_abs(last_x, last_y, 0);
button_click(1, 0);
} else if (last_mask && !mask) {
ptr_abs(last_x, last_y, 0);
button_click(0, 0);
} else if (last_mask && mask) {
;
}
}
last_mask = mask;
} else if (mask != last_mask) {
int i;
for (i=1; i <= MAX_BUTTONS; i++) {
int down, b = 1 << (i-1);
@ -902,6 +1211,9 @@ void uinput_pointer_command(int mask, int x, int y, rfbClientPtr client) {
}
button_click(down, i);
}
if (mask && uinput_abs && touch_pressure >= 0) {
ptr_abs(last_x, last_y, touch_pressure);
}
last_mask = mask;
}
bmask = mask;
@ -912,6 +1224,7 @@ void uinput_key_command(int down, int keysym, rfbClientPtr client) {
struct input_event ev;
int scancode;
allowed_input_t input;
int d = direct_key_fd < 0 ? fd : direct_key_fd;
if (injectable && strchr(injectable, 'K') == NULL) {
return;
@ -929,7 +1242,7 @@ void uinput_key_command(int down, int keysym, rfbClientPtr client) {
if (scancode < 0) {
return;
}
if (db) fprintf(stderr, "uinput_key_command: %d -> %d %s\n", keysym, scancode, down ? "down" : "up");
if (db) fprintf(stderr, "uinput_key_command: %d -> %d %s fd=%d\n", keysym, scancode, down ? "down" : "up", d);
memset(&ev, 0, sizeof(ev));
gettimeofday(&ev.time, NULL);
@ -937,12 +1250,12 @@ void uinput_key_command(int down, int keysym, rfbClientPtr client) {
ev.code = (unsigned char) scancode;
ev.value = down;
write(fd, &ev, sizeof(ev));
write(d, &ev, sizeof(ev));
ev.type = EV_SYN;
ev.code = SYN_REPORT;
ev.value = 0;
write(fd, &ev, sizeof(ev));
write(d, &ev, sizeof(ev));
if (0 <= scancode && scancode < 256) {
key_pressed[scancode] = down ? 1 : 0;
@ -952,6 +1265,10 @@ void uinput_key_command(int down, int keysym, rfbClientPtr client) {
#endif
}
#if 0
grep 'case XK_' x0vnc.c | sed -e 's/case /$key_lookup{/' -e 's/:/}/' -e 's/return /= $/'
#endif
static int lookup_code(int keysym) {
if (keysym == NoSymbol) {

@ -37,6 +37,7 @@ so, delete this exception statement from your version.
extern int check_uinput(void);
extern int initialize_uinput(void);
extern void shutdown_uinput(void);
extern int set_uinput_accel(char *str);
extern int set_uinput_thresh(char *str);
extern void set_uinput_reset(int ms);

@ -565,6 +565,12 @@ char *get_pty_ptmx(int *fd_p) {
ioctl(fd, TIOCFLUSH, (char *) 0);
#endif
if (strlen(slave) > sizeof(slave_str)/2) {
rfbLog("get_pty_ptmx: slave string length too long.\n");
close(fd);
return NULL;
}
strcpy(slave_str, slave);
*fd_p = fd;
return slave_str;
@ -1743,7 +1749,7 @@ void unixpw_keystroke(rfbBool down, rfbKeySym keysym, int init) {
down ? "down":"up ", keysym, keystr);
}
if (keysym == XK_Return || keysym == XK_Linefeed) {
if (keysym == XK_Return || keysym == XK_Linefeed || keysym == XK_Tab) {
/* let "up" pass down below for Return case */
if (down) {
return;
@ -1866,7 +1872,7 @@ void unixpw_keystroke(rfbBool down, rfbKeySym keysym, int init) {
return;
}
if (keysym == XK_Return || keysym == XK_Linefeed) {
if (keysym == XK_Return || keysym == XK_Linefeed || keysym == XK_Tab) {
char pw[] = "Password: ";
if (down) {

@ -2769,6 +2769,7 @@ if (db) fprintf(stderr, "\n");
clean_up_exit(1);
}
n = fread(line2, 1, 16384, p);
pclose(p);
}
if (tmp_fd >= 0) {
unlink(tmp);

@ -96,8 +96,8 @@ extern struct timeval _mysleep;
((KeySym)(keysym) != XK_Caps_Lock) && ((KeySym)(keysym) != XK_Shift_Lock)))
/*
* Not sure why... but when threaded we have to mutex our X11 calls to
* avoid XIO crashes.
* When threaded we have to mutex our X11 calls to avoid XIO crashes
* due to callbacks.
*/
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
extern MUTEX(x11Mutex);

@ -434,23 +434,23 @@ static void apply_settings(char *dev, char *settings, int *fd) {
static double dval = 0.05;
static int v4l1_dpct(int old, int d) {
int new, max = V4L1_MAX;
int newval, max = V4L1_MAX;
/* -1 and 1 are special cases for "small increments" */
if (d == -1) {
new = old - (int) (dval * max);
newval = old - (int) (dval * max);
} else if (d == 1) {
new = old + (int) (dval * max);
newval = old + (int) (dval * max);
} else {
new = (d * max)/100;
newval = (d * max)/100;
}
if (new < 0) {
new = 0;
if (newval < 0) {
newval = 0;
}
if (new > max) {
new = max;
if (newval > max) {
newval = max;
}
return new;
return newval;
}
static void v4l_requery(void) {

@ -1,8 +1,8 @@
.\" This file was automatically generated from x11vnc -help output.
.TH X11VNC "1" "September 2010" "x11vnc " "User Commands"
.TH X11VNC "1" "December 2010" "x11vnc " "User Commands"
.SH NAME
x11vnc - allow VNC connections to real X11 displays
version: 0.9.13, lastmod: 2010-09-10
version: 0.9.13, lastmod: 2010-12-20
.SH SYNOPSIS
.B x11vnc
[OPTION]...
@ -925,6 +925,11 @@ server with them, grabbing the keyboard himself, etc.
Some degree of cooperation from the person at the
display is assumed. This is intended for remote
help-desk or educational usage modes.
.IP
Note: on some recent (12/2010) X servers and/or
desktops, \fB-grabkbd\fR no longer works: it prevents the
window manager from resizing windows and similar things.
Try \fB-ungrabboth\fR below (might not work.)
.PP
\fB-grabptr\fR
.IP
@ -940,6 +945,13 @@ for resizes, etc, will
act on the local user's input. Again, some degree of
cooperation from the person at the display is assumed.
.PP
\fB-ungrabboth\fR
.IP
Whenever there is any input (either keyboard or
pointer), ungrab *both* the keyboard and the pointer
while injecting the synthetic input. This is to allow
window managers, etc. a chance to grab.
.PP
\fB-grabalways\fR
.IP
Apply both \fB-grabkbd\fR and \fB-grabptr\fR even when no VNC
@ -1569,6 +1581,15 @@ xauthority data for the display. For example;
.IP
xauth extract - $DISPLAY"
.IP
NOTE: As specified in the previous paragraph, you can
supply your own WAIT:cmd=... program or script, BUT
there are two very useful *BUILT-IN* ones: FINDDISPLAY
(alias \fB-find\fR above) and FINDCREATEDISPLAY (alias \fB-create\fR
above.) Most people use these instead of creating
their own script. Read the following (especially the
BUILT-IN modes sections) to see how to configure these
two useful builtin \fB-display\fR WAIT: modes.
.IP
In the case of \fB-unixpw\fR (and \fB-unixpw_nis\fR only if x11vnc
is running as root), then the cmd= command is run
as the user who just authenticated via the login and
@ -1600,6 +1621,11 @@ type and enter your password incorrectly, to retrieve
your long "login:" line press the Up arrow once
(before typing anything else).
.IP
Most of these colon options only apply to the builtin
FINDDISPLAY and FINDCREATEDISPLAY modes, but note
that they are passed to the extrenal command in the
environment as well and so could be used.
.IP
In the login panel, press F1 to get a list of the
available options that you can add after the username.
.IP
@ -1633,23 +1659,19 @@ prompt. For example \fB-env\fR FD_USERPREFS=.x11vnc_create
and the user put "geom=1600x1200" in his
~/.x11vnc_create file.
.IP
To troubleshoot the FINDCREATEDISPLAY mechanism,
set the following env. var. to an output log file,
e.g \fB-env\fR CREATE_DISPLAY_OUTPUT=/tmp/mydebug.txt
.IP
To disable the option setting set the environment
variable X11VNC_NO_UNIXPW_OPTS=1 before starting x11vnc.
To set any other options, the user can use the gui
(x11vnc \fB-gui\fR connect) or the remote control method
(x11vnc \fB-R\fR opt:val) during his VNC session.
.IP
The combination of \fB-display\fR WAIT:cmd=... and \fB-unixpw\fR
allows automatic pairing of an unix authenticated VNC
user with his desktop. This could be very useful on
SunRays and also any system where multiple users share
a given machine. The user does not need to remember
special ports or passwords set up for his desktop
and VNC.
So we see the combination of \fB-display\fR WAIT:cmd=... and
\fB-unixpw\fR allows automatic pairing of an unix
authenticated VNC user with his desktop. This could
be very useful on SunRays and also any system where
multiple users share a given machine. The user does
not need to remember special ports or passwords set up
for his desktop and VNC.
.IP
A nice way to use WAIT:cmd=... is out of
.IR inetd (8)
@ -1662,7 +1684,9 @@ the user as well. Note: there will be a 2nd SSL helper
process that will not switch, but it is only encoding
and decoding the encrypted stream at that point.
.IP
Automatic Finding of User X Sessions:
BUILT-IN modes:
.IP
\fB--\fR Automatic Finding of User X Sessions \fB--\fR
.IP
As a special case, WAIT:cmd=FINDDISPLAY will run a
script that works on most Unixes to determine a user's
@ -1670,7 +1694,7 @@ DISPLAY variable and xauthority data (see
.IR who (1)
).
.IP
The option "\fB-find\fR" is an alias for this mode.
NOTE: The option "\fB-find\fR" is an alias for this mode.
.IP
To have this default script printed to stdout (e.g. for
customization) run with WAIT:cmd=FINDDISPLAY-print To
@ -1715,7 +1739,14 @@ using "+" instead of "," If "nd=all" or you set
X11VNC_SKIP_DISPLAY=all then all display finding fails
as if you set X11VNC_FINDDISPLAY_ALWAYS_FAILS=1 (below.)
.IP
Automatic Creation of User X Sessions:
On some systems
.IR lsof (1)
can be very slow. Set the
env. var. FIND_DISPLAY_NO_LSOF=1 to skip using lsof to
try to find the Linux VT the X server is running on.
set FIND_DISPLAY_NO_VT_FIND=1 to avoid looking at all.
.IP
\fB--\fR Automatic Creation of User X Sessions \fB--\fR
.IP
An interesting option is WAIT:cmd=FINDCREATEDISPLAY
that is like FINDDISPLAY in that is uses the same method
@ -1724,13 +1755,19 @@ find one it will try to *start* up an X server session
for the user. This is the only time x11vnc tries to
actually start up an X server.
.IP
The option "\fB-create\fR" is an alias for this mode.
NOTE: The option "\fB-create\fR" is an alias for this mode.
.IP
It will start looking for an open display number at :20
Override via X11VNC_CREATE_STARTING_DISPLAY_NUMBER=n
By default 80 X displays are allowed (i.e. going to :99)
Override via X11VNC_CREATE_MAX_DISPLAYS=n
.IP
For its heuristics, the create display script sets
LC_ALL=C so that command output is uniform. By default
it will try to restore LC_ALL right before starting the
user session. However, if you don't mind it keeping
LC_ALL=C set the env. var.: X11VNC_CREATE_LC_ALL_C_OK=1
.IP
By default FINDCREATEDISPLAY will try Xvfb and then
Xdummy:
.IP
@ -1757,6 +1794,10 @@ The user must exit the X session in the usual way for
it to terminate (or kill the X server process if all
else fails).
.IP
To troubleshoot the FINDCREATEDISPLAY mechanism,
set the following env. var. to an output log file,
e.g \fB-env\fR CREATE_DISPLAY_OUTPUT=/tmp/mydebug.txt
.IP
So this is a somewhat odd mode for x11vnc in that it
will start up and poll virtual X servers! This can
be used from, say,
@ -4614,6 +4655,7 @@ Default: take naps
Time in seconds after NO activity (e.g. screen blank)
to really throttle down the screen polls (i.e. sleep
for about 1.5 secs). Use 0 to disable. Default: 60
Set the env. var. X11VNC_SB_FACTOR to scale it.
.PP
\fB-readtimeout\fR \fIn\fR
.IP
@ -5129,18 +5171,19 @@ do not prefer the default 16bpp set RAWFB_VCSA_BPP to
using the 'console_guess' string printed at startup,
be sure to indicate the snap: method.
.IP
uinput: If the Linux version appears to be 2.6 or
later and the "uinput" module appears to be present
(modprobe uinput), then the uinput method will be used
instead of /dev/ttyN. uinput allows insertion of BOTH
keystrokes and mouse input and so it preferred when
accessing graphical (e.g. QT-embedded) linux console
apps. See \fB-pipeinput\fR UINPUT below for more information
on this mode; you will have to use \fB-pipeinput\fR if you
want to tweak any UINPUT parameters. You may also want
to also use the \fB-nodragging\fR and \fB-cursor\fR none options.
Use "console0", etc or \fB-pipeinput\fR CONSOLE to force
the /dev/ttyN method.
uinput: If the Linux version appears to be 2.6
or later and the "uinput" module appears to be
present (modprobe uinput), then the uinput method
will be used instead of /dev/ttyN. uinput allows
insertion of BOTH keystrokes and mouse input and so it
preferred when accessing graphical (e.g. QT-embedded)
linux console apps. It also provides more accurate
keystroke insertion. See \fB-pipeinput\fR UINPUT below for
more information on this mode; you will have to use
\fB-pipeinput\fR if you want to tweak any UINPUT parameters.
You may also want to also use the \fB-nodragging\fR and
\fB-cursor\fR none options. Use "console0", etc or
\fB-pipeinput\fR CONSOLE to force the /dev/ttyN method.
.IP
Note you can change the Linux VT remotely using the
.IR chvt (1)
@ -5181,7 +5224,11 @@ This mode is really only of use if you are trying
to improve performance in the case of many (e.g. >
10) simultaneous VNC viewers, and you try a divide
and conquer scheme to reduce bandwidth and improve
responsiveness.
responsiveness. (However, another user found this mode
useful to export a demo display through a slow link:
then multiple demo viewers connected to the reflecting
x11vnc on the fast side of the link, and so avoided
all of the demo viewers going through the slow link.)
.IP
For example, if there will be 64 simultaneous VNC
viewers this can lead to a lot of redundant VNC traffic
@ -5212,6 +5259,13 @@ the password needed to log into the vnc host server, or
to "file:path_to_file" to indicate a file containing
the password as its first line.
.IP
To set the pixel format that x11vnc requests as a VNC
CLIENT set the env. vars: X11VNC_REFLECT_bitsPerSample
X11VNC_REFLECT_samplesPerPixel, and
X11VNC_REFLECT_bytesPerPixel; the defaults are 8, 3, 4.
2, 3, 1 would give a low color mode. See the function
rfbGetClient() in libvncclient for more info.
.IP
The VNC HOST mode implies \fB-shared.\fR Use \fB-noshared\fR as
a subsequent cmdline option to disable sharing.
.PP
@ -5278,7 +5332,8 @@ and insert the module with "modprobe uinput".
.IP
The UINPUT mode currently only does US keyboards (a
scan code option may be added), and not all keysyms
are supported.
are supported. But it is probably more accurate than
the "CONSOLE" method.
.IP
You may want to use the options \fB-cursor\fR none and
\fB-nodragging\fR in this mode.
@ -5320,16 +5375,6 @@ in 1 jump), This correction seems to be needed but can
cause jerkiness or unexpected behavior with menus, etc.
Use reset=0 to disable.
.IP
If the uinput device has an absolute pointer (as opposed
to a normal mouse that is a relative pointer) you can
specify the option "abs". Note that a touchpad
on a laptop is an absolute device to some degree.
This (usually) avoids all the problems with mouse
acceleration. If x11vnc has trouble deducing the size
of the device, use "abs=WxH". Furthermore, if the
device is a touchscreen (assumed to have an absolute
pointer) use "touch" or "touch=WxH".
.IP
If you set the env. var X11VNC_UINPUT_THRESHOLDS then
the thresh=n mode will be enabled. It is currently
not working well. If |dx| <= thresh and |dy| < thresh
@ -5339,8 +5384,70 @@ no acceleration is applied. Use "thresh=+n" |dx| +
Example:
\fB-pipeinput\fR UINPUT:accel=4.0 \fB-cursor\fR none
.IP
You can also set the env. var X11VNC_UINPUT_DEBUG=1 or
higher to get debugging output for UINPUT mode.
If the uinput device has an absolute pointer (as opposed
to a normal mouse that is a relative pointer) you can
specify the option "abs". Note that a touchpad
on a laptop is an absolute device to some degree.
This (usually) avoids all the problems with mouse
acceleration. If x11vnc has trouble deducing the
size of the device, use "abs=WxH". Furthermore,
if the device is a touchscreen (assumed to have an
absolute pointer) use "touch" or "touch=WxH".
For touchscreens, when a mouse button is pressed,
a pressure increase is injected, and when the button
is released a pressure of zero is injected.
.IP
If touch has been set, use "touch_always=1" to
indicate whenever the mouse moves with no button
pressed, a touch event of zero pressure should be
sent anyway. Also use "btn_touch=1" to indicate a
BTN_TOUCH keystroke press or release should be sent
instead of a pressure change. Set "dragskip=n" to
skip n dragged mouse touches (with pressure applied)
before injecting one. To indicate the pressure that
should be sent when there is a button click for a
touchscreen device, specify pressure=n, e.g. n=5. The
default is n=1.
.IP
If a touch screen is being used ("touch" above)
and it is having its input processed by tslib, you can
specify the tslib calibration file via tslib_cal=<file>.
For example, tslib_cal=/etc/pointercal. To get accurate
or even usable positioning this is required when tslib
is in use.
.IP
The Linux uinput mechanism can be bypassed and one can
write input events DIRECTLY to the devices instead.
To do this, specify one or more of the following
for the input classes: direct_rel=<device>
direct_abs=<device> direct_btn=<device> or
direct_key=<device>. The <device> file is usually
something like /dev/input/event1 but you can specify
any device file or pipe. You must specify each one
of the above classes even if they correspond to the
same device file (rel/abs and btn are often the same.)
Look at the file /proc/bus/input/devices to get an idea
what is available and the device filenames. Note:
The /dev/input/mouse* devices do not seem to work,
use the corresponding /dev/input/event* file instead.
Any input class not directly specified as above will be
handled via the uinput mechanism. To disable creating a
uinput device (and thereby discarding unhandled input),
specify "nouinput".
.IP
Examples:
.IP
\fB-pipeinput\fR UINPUT:direct_abs=/dev/input/event1
.IP
this was used on a qtmoko Neo freerunner (armel):
.IP
\fB-pipeinput\fR UINPUT:touch,tslib_cal=/etc/pointercal,
direct_abs=/dev/input/event1,nouinput,dragskip=4
.IP
(where the long line has been split into two.)
.IP
You can set the env. var X11VNC_UINPUT_DEBUG=1 or higher
to get debugging output for UINPUT mode.
.PP
\fB-macnodim\fR
.IP

@ -1065,6 +1065,7 @@ static void check_rcfile(int argc, char **argv) {
if (! home) {
norc = 1;
} else {
memset(rcfile, 0, sizeof(rcfile));
strncpy(rcfile, home, 500);
free(home);
@ -1394,6 +1395,7 @@ static void quick_pw(char *str) {
if(fgets(tmp, 1024, in) == NULL) {
exit(2);
}
fclose(in);
q = strdup(tmp);
} else {
q = strdup(str+1);
@ -2574,6 +2576,10 @@ int main(int argc, char* argv[]) {
grab_ptr = 1;
continue;
}
if (!strcmp(arg, "-ungrabboth")) {
ungrab_both = 1;
continue;
}
if (!strcmp(arg, "-grabalways")) {
grab_kbd = 1;
grab_ptr = 1;
@ -4274,7 +4280,7 @@ int main(int argc, char* argv[]) {
char *pstr = "%VNCDISPLAY";
if (strstr(logfile, pstr)) {
char *h = this_host();
char *s, *q, *new;
char *s, *q, *newlog;
int n, p = got_rfbport_val;
/* we don't really know the port yet... so guess */
if (p < 0) {
@ -4293,23 +4299,23 @@ int main(int argc, char* argv[]) {
n++;
q = t+1;
}
new = (char *) malloc(strlen(logfile) + n * strlen(pstr));
new[0] = '\0';
newlog = (char *) malloc(strlen(logfile) + n * strlen(pstr));
newlog[0] = '\0';
q = logfile;
while (1) {
char *t = strstr(q, pstr);
if (!t) {
strcat(new, q);
strcat(newlog, q);
break;
}
strncat(new, q, t - q);
strcat(new, s);
strncat(newlog, q, t - q);
strcat(newlog, s);
q = t + strlen(pstr);
}
logfile = new;
logfile = newlog;
if (!quiet && !got_inetd) {
rfbLog("Expanded logfile to '%s'\n", new);
rfbLog("Expanded logfile to '%s'\n", newlog);
}
free(s);
@ -4317,7 +4323,7 @@ int main(int argc, char* argv[]) {
pstr = "%HOME";
if (strstr(logfile, pstr)) {
char *h = get_home_dir();
char *s, *q, *new;
char *s, *q, *newlog;
s = (char *) malloc(strlen(h) + 32);
sprintf(s, "%s", h);
@ -4329,23 +4335,23 @@ int main(int argc, char* argv[]) {
n++;
q = t+1;
}
new = (char *) malloc(strlen(logfile) + n * strlen(pstr));
new[0] = '\0';
newlog = (char *) malloc(strlen(logfile) + n * strlen(pstr));
newlog[0] = '\0';
q = logfile;
while (1) {
char *t = strstr(q, pstr);
if (!t) {
strcat(new, q);
strcat(newlog, q);
break;
}
strncat(new, q, t - q);
strcat(new, s);
strncat(newlog, q, t - q);
strcat(newlog, s);
q = t + strlen(pstr);
}
logfile = new;
logfile = newlog;
if (!quiet && !got_inetd) {
rfbLog("Expanded logfile to '%s'\n", new);
rfbLog("Expanded logfile to '%s'\n", newlog);
}
free(s);
}

@ -133,6 +133,8 @@ so, delete this exception statement from your version.
* -DPOLL_8TO24_DELAY=N
* -DDEBUG_XEVENTS=1 enable printout for X events.
*
* -DX11VNC_MACOSX_USE_GETMAINDEVICE use deprecated GetMainDevice on macosx
*
* Set these in CPPFLAGS before running configure. E.g.:
*
* % env CPPFLAGS="-DFOREVER -DREMOTE_CONTROL=0" ./configure

@ -47,7 +47,7 @@ int xtrap_base_event_type = 0;
int xdamage_base_event_type = 0;
/* date +'lastmod: %Y-%m-%d' */
char lastmod[] = "0.9.13 lastmod: 2010-09-10";
char lastmod[] = "0.9.13 lastmod: 2010-12-20";
/* X display info */

@ -57,6 +57,7 @@ int grab_buster = 0;
int grab_kbd = 0;
int grab_ptr = 0;
int grab_always = 0;
int ungrab_both = 0;
int grab_local = 0;
int sync_tod_delay = 20;

@ -39,6 +39,7 @@ extern int grab_buster;
extern int grab_kbd;
extern int grab_ptr;
extern int grab_always;
extern int ungrab_both;
extern int grab_local;
extern int sync_tod_delay;

@ -73,7 +73,7 @@ void initialize_xrecord(void);
void zerodisp_xrecord(void);
void shutdown_xrecord(void);
int xrecord_skip_keysym(rfbKeySym keysym);
int xrecord_skip_button(int new, int old);
int xrecord_skip_button(int newb, int old);
int xrecord_scroll_keysym(rfbKeySym keysym);
void check_xrecord_reset(int force);
void xrecord_watch(int start, int setby);
@ -410,9 +410,9 @@ int xrecord_skip_keysym(rfbKeySym keysym) {
return 0;
}
int xrecord_skip_button(int new, int old) {
int xrecord_skip_button(int new_button, int old) {
/* unused vars warning: */
if (new || old) {}
if (new_button || old) {}
return 0;
}

@ -60,7 +60,7 @@ extern void initialize_xrecord(void);
extern void zerodisp_xrecord(void);
extern void shutdown_xrecord(void);
extern int xrecord_skip_keysym(rfbKeySym keysym);
extern int xrecord_skip_button(int new, int old);
extern int xrecord_skip_button(int newb, int old);
extern int xrecord_scroll_keysym(rfbKeySym keysym);
extern void check_xrecord_reset(int force);
extern void xrecord_watch(int start, int setby);

@ -347,7 +347,15 @@ XImage *XCreateImage_wr(Display *disp, Visual *visual, unsigned int depth,
xi = (XImage *) malloc(sizeof(XImage));
memset(xi, 0, sizeof(XImage));
xi->depth = depth;
xi->bits_per_pixel = (depth == 24) ? 32 : depth;
if (depth >= 24) {
xi->bits_per_pixel = 32;
} else if (depth > 16) {
xi->bits_per_pixel = 24;
} else if (depth > 8) {
xi->bits_per_pixel = 16;
} else {
xi->bits_per_pixel = 8;
}
xi->format = format;
xi->xoffset = offset;
xi->data = data;
@ -706,7 +714,7 @@ void copy_raw_fb(XImage *dest, int x, int y, unsigned int w, unsigned int h) {
src = snap->data + snap->bytes_per_line*y + pixelsize*x;
dst = dest->data;
if (db) fprintf(stderr, "snap->bytes_per_line: %d, dest->bytes_per_line: %d, w: %d h: %d dpy_x: %d wdpy_x: %d cdpy_x: %d\n", snap->bytes_per_line, dest->bytes_per_line, w, h, dpy_x, wdpy_x, cdpy_x);
if (db) fprintf(stderr, "snap->bytes_per_line: %d, dest->bytes_per_line: %d, w: %d h: %d dpy_x: %d wdpy_x: %d cdpy_x: %d bpp: %d pixelsize: %d\n", snap->bytes_per_line, dest->bytes_per_line, w, h, dpy_x, wdpy_x, cdpy_x, bpp, pixelsize);
for (line = 0; line < h; line++) {
memcpy(dst, src, w * pixelsize);
@ -725,7 +733,7 @@ if (db) fprintf(stderr, "snap->bytes_per_line: %d, dest->bytes_per_line: %d, w:
src = raw_fb_addr + raw_fb_offset + bpl*y + pixelsize*x;
dst = dest->data;
if (db) fprintf(stderr, "bpl: %d, dest->bytes_per_line: %d, w: %d h: %d dpy_x: %d wdpy_x: %d cdpy_x: %d\n", bpl, dest->bytes_per_line, w, h, dpy_x, wdpy_x, cdpy_x);
if (db) fprintf(stderr, "bpl: %d, dest->bytes_per_line: %d, w: %d h: %d dpy_x: %d wdpy_x: %d cdpy_x: %d bpp: %d pixelsize: %d\n", bpl, dest->bytes_per_line, w, h, dpy_x, wdpy_x, cdpy_x, bpp, pixelsize);
for (line = 0; line < h; line++) {
memcpy(dst, src, w * pixelsize);
@ -878,6 +886,7 @@ void XTRAP_FakeKeyEvent_wr(Display* dpy, KeyCode key, Bool down,
void XTestFakeKeyEvent_wr(Display* dpy, KeyCode key, Bool down,
unsigned long delay) {
static int first = 1;
int regrab = 0;
RAWFB_RET_VOID
@ -903,11 +912,16 @@ void XTestFakeKeyEvent_wr(Display* dpy, KeyCode key, Bool down,
if (grab_kbd) {
XUngrabKeyboard(dpy, CurrentTime);
regrab = 1;
}
if (grab_ptr && ungrab_both) {
XUngrabPointer(dpy, CurrentTime);
regrab = 1;
}
if (xtrap_input) {
XTRAP_FakeKeyEvent_wr(dpy, key, down, delay);
if (grab_kbd) {
if (regrab) {
adjust_grabs(1, 1);
}
return;
@ -923,7 +937,7 @@ void XTestFakeKeyEvent_wr(Display* dpy, KeyCode key, Bool down,
}
#if LIBVNCSERVER_HAVE_XTEST
XTestFakeKeyEvent(dpy, key, down, delay);
if (grab_kbd) {
if (regrab) {
adjust_grabs(1, 1);
}
if (debug_keyboard) {
@ -964,6 +978,7 @@ void XTRAP_FakeButtonEvent_wr(Display* dpy, unsigned int button, Bool is_press,
void XTestFakeButtonEvent_wr(Display* dpy, unsigned int button, Bool is_press,
unsigned long delay) {
int regrab = 0;
RAWFB_RET_VOID
#if NO_X11
@ -974,11 +989,16 @@ void XTestFakeButtonEvent_wr(Display* dpy, unsigned int button, Bool is_press,
if (grab_ptr) {
XUngrabPointer(dpy, CurrentTime);
regrab = 1;
}
if (grab_kbd && ungrab_both) {
XUngrabKeyboard(dpy, CurrentTime);
regrab = 1;
}
if (xtrap_input) {
XTRAP_FakeButtonEvent_wr(dpy, button, is_press, delay);
if (grab_ptr) {
if (regrab) {
adjust_grabs(1, 1);
}
return;
@ -995,7 +1015,7 @@ void XTestFakeButtonEvent_wr(Display* dpy, unsigned int button, Bool is_press,
#if LIBVNCSERVER_HAVE_XTEST
XTestFakeButtonEvent(dpy, button, is_press, delay);
#endif
if (grab_ptr) {
if (regrab) {
adjust_grabs(1, 1);
}
#endif /* NO_X11 */
@ -1029,6 +1049,7 @@ void XTRAP_FakeMotionEvent_wr(Display* dpy, int screen, int x, int y,
void XTestFakeMotionEvent_wr(Display* dpy, int screen, int x, int y,
unsigned long delay) {
int regrab = 0;
RAWFB_RET_VOID
#if NO_X11
@ -1039,11 +1060,16 @@ void XTestFakeMotionEvent_wr(Display* dpy, int screen, int x, int y,
if (grab_ptr) {
XUngrabPointer(dpy, CurrentTime);
regrab = 1;
}
if (grab_kbd && ungrab_both) {
XUngrabKeyboard(dpy, CurrentTime);
regrab = 1;
}
if (xtrap_input) {
XTRAP_FakeMotionEvent_wr(dpy, screen, x, y, delay);
if (grab_ptr) {
if (regrab) {
adjust_grabs(1, 1);
}
return;
@ -1056,7 +1082,7 @@ void XTestFakeMotionEvent_wr(Display* dpy, int screen, int x, int y,
#if LIBVNCSERVER_HAVE_XTEST
XTestFakeMotionEvent(dpy, screen, x, y, delay);
#endif
if (grab_ptr) {
if (regrab) {
adjust_grabs(1, 1);
}
#endif /* NO_X11 */

Loading…
Cancel
Save