]> git.proxmox.com Git - vncterm.git/blob - tigerpatches/javascript-events.patch
imported from svn 'vncterm/pve2'
[vncterm.git] / tigerpatches / javascript-events.patch
1 Index: new/java/src/com/tigervnc/vncviewer/VncViewer.java
2 ===================================================================
3 --- new.orig/java/src/com/tigervnc/vncviewer/VncViewer.java 2011-01-24 15:39:36.000000000 +0100
4 +++ new/java/src/com/tigervnc/vncviewer/VncViewer.java 2011-01-24 16:08:09.000000000 +0100
5 @@ -27,11 +27,15 @@
6
7 package com.tigervnc.vncviewer;
8
9 +import netscape.javascript.*;
10 import java.awt.*;
11 import java.awt.event.*;
12 import java.io.*;
13 import java.net.*;
14
15 +import java.awt.Graphics;
16 +import java.applet.Applet;
17 +
18 public class VncViewer extends java.applet.Applet
19 implements java.lang.Runnable, WindowListener, ComponentListener {
20
21 @@ -91,6 +95,9 @@
22 int debugStatsExcludeUpdates;
23 int debugStatsMeasureUpdates;
24
25 + JSObject jswin;
26 + String myid;
27 +
28 // Reference to this applet for inter-applet communication.
29 public static java.applet.Applet refApplet;
30
31 @@ -104,6 +111,11 @@
32
33 refApplet = this;
34
35 + if (inAnApplet) {
36 + jswin = JSObject.getWindow(this);
37 + myid = getParameter("id");
38 + }
39 +
40 if (inSeparateFrame) {
41 vncFrame = new Frame("TigerVNC");
42 if (!inAnApplet) {
43 @@ -134,6 +146,9 @@
44
45 rfbThread = new Thread(this);
46 rfbThread.start();
47 +
48 + String[] myparam = { myid, "init"};
49 + jswin.call("PVE_vnc_console_event", myparam);
50 }
51
52 public void update(Graphics g) {
53 @@ -936,6 +951,8 @@
54
55 if (inAnApplet) {
56 showMessage("Disconnected");
57 + String[] myparam = { myid, "disconnect"};
58 + jswin.call("PVE_vnc_console_event", myparam);
59 } else {
60 System.exit(0);
61 }
62 @@ -953,6 +970,8 @@
63 // vncContainer null, applet not inited,
64 // can not present the error to the user.
65 Thread.currentThread().stop();
66 + String[] myparam = { myid, "error", str};
67 + jswin.call("PVE_vnc_console_event", myparam);
68 } else {
69 System.exit(1);
70 }
71 @@ -974,6 +993,8 @@
72 rfb.close();
73
74 if (inAnApplet) {
75 + String[] myparam = { myid, "error", str};
76 + jswin.call("PVE_vnc_console_event", myparam);
77 showMessage(str);
78 } else {
79 System.exit(1);
80 @@ -1043,6 +1064,9 @@
81 rfb.close();
82 if (inSeparateFrame)
83 vncFrame.dispose();
84 +
85 + String[] myparam = { myid, "destroy"};
86 + jswin.call("PVE_vnc_console_event", myparam);
87 }
88
89 //
90 @@ -1091,6 +1115,8 @@
91 if (!inAnApplet) {
92 System.exit(0);
93 }
94 + String[] myparam = { myid, "close"};
95 + jswin.call("PVE_vnc_console_event", myparam);
96 }
97
98 //
99 Index: new/java/src/com/tigervnc/vncviewer/Makefile
100 ===================================================================
101 --- new.orig/java/src/com/tigervnc/vncviewer/Makefile 2011-01-24 15:39:36.000000000 +0100
102 +++ new/java/src/com/tigervnc/vncviewer/Makefile 2011-01-24 16:08:09.000000000 +0100
103 @@ -4,7 +4,10 @@
104
105 CP = cp
106 JC = javac
107 -JCFLAGS = -target 1.5 -classpath ../../../
108 +# define java.ext.dirs, else plugin.jar (JSObject) is not found
109 +# is there a better way to include that?
110 +JCFLAGS = -target 1.5 -classpath ../../../ -Djava.ext.dirs=/usr/lib/jvm/java-6-sun-1.6.0.22/jre/lib/
111 +
112 JAR = jar
113 ARCHIVE = VncViewer.jar
114 MANIFEST = MANIFEST.MF