summaryrefslogtreecommitdiffstats
path: root/classes/ssl/tightvnc-1.3dev7_javasrc-vncviewer-cursor-colors+no-tab-traversal.patch
blob: bc10f3cfe849f82e7ca225f6c014947a6b9a1180 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
--- 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
OpenPOWER on IntegriCloud