spice-html5-rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. data/COPYING +674 -0
  2. data/COPYING.LESSER +165 -0
  3. data/LICENSE.txt +15 -0
  4. data/README.md +35 -0
  5. data/lib/spice-html5-rails/version.rb +7 -0
  6. data/lib/spice-html5-rails.rb +10 -0
  7. data/vendor/assets/javascripts/spice-html5.js +25 -0
  8. data/vendor/assets/javascripts/spiceHTML5/atKeynames.js +183 -0
  9. data/vendor/assets/javascripts/spiceHTML5/bitmap.js +51 -0
  10. data/vendor/assets/javascripts/spiceHTML5/cursor.js +92 -0
  11. data/vendor/assets/javascripts/spiceHTML5/display.js +806 -0
  12. data/vendor/assets/javascripts/spiceHTML5/enums.js +282 -0
  13. data/vendor/assets/javascripts/spiceHTML5/inputs.js +271 -0
  14. data/vendor/assets/javascripts/spiceHTML5/lz.js +166 -0
  15. data/vendor/assets/javascripts/spiceHTML5/main.js +177 -0
  16. data/vendor/assets/javascripts/spiceHTML5/png.js +256 -0
  17. data/vendor/assets/javascripts/spiceHTML5/quic.js +1335 -0
  18. data/vendor/assets/javascripts/spiceHTML5/spiceconn.js +455 -0
  19. data/vendor/assets/javascripts/spiceHTML5/spicedataview.js +96 -0
  20. data/vendor/assets/javascripts/spiceHTML5/spicemsg.js +883 -0
  21. data/vendor/assets/javascripts/spiceHTML5/spicetype.js +480 -0
  22. data/vendor/assets/javascripts/spiceHTML5/thirdparty/jsbn.js +589 -0
  23. data/vendor/assets/javascripts/spiceHTML5/thirdparty/prng4.js +79 -0
  24. data/vendor/assets/javascripts/spiceHTML5/thirdparty/rng.js +102 -0
  25. data/vendor/assets/javascripts/spiceHTML5/thirdparty/rsa.js +146 -0
  26. data/vendor/assets/javascripts/spiceHTML5/thirdparty/sha1.js +346 -0
  27. data/vendor/assets/javascripts/spiceHTML5/ticket.js +250 -0
  28. data/vendor/assets/javascripts/spiceHTML5/utils.js +261 -0
  29. data/vendor/assets/javascripts/spiceHTML5/wire.js +123 -0
  30. metadata +108 -0
data/COPYING.LESSER ADDED
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
data/LICENSE.txt ADDED
@@ -0,0 +1,15 @@
1
+ spice-html5 is Copyright (C) 2012 by Jeremy P. White <jwhite@codeweavers.com>
2
+
3
+ Some portions of spice-html5 are copyright to their individual authors.
4
+ Please refer to the individual source files and/or to the spice-html5 commit
5
+ history: git://anongit.freedesktop.org/spice/spice-html5
6
+
7
+ spice-html5 is licensed under the LGPL (GNU Lesser General Public License)
8
+
9
+ The license texts are included at:
10
+ COPYING and
11
+ COPYING.LESSER
12
+
13
+ Or alternatively the license texts may be found here:
14
+ http://www.gnu.org/licenses/lgpl.html and
15
+ http://www.gnu.org/licenses/gpl.html
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # Spice::Html5::Rails
2
+
3
+ The [spice-html5](/www.spice-space.com) for the Rails 3.1 asset pipeline.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'spice-html5-rails'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install spice-html5-rails
18
+
19
+ ## Usage
20
+
21
+ Add in application.js or some per-controller .js.
22
+ //= require spice-html5
23
+
24
+ ## Source
25
+
26
+ Spice home page: [http://www.spice-space.org](http://www.spice-space.org)
27
+ Spice-html5 code is available here: git://anongit.freedesktop.org/spice/spice-html5
28
+
29
+ ## Contributing
30
+
31
+ 1. Fork it
32
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
33
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
34
+ 4. Push to the branch (`git push origin my-new-feature`)
35
+ 5. Create new Pull Request
@@ -0,0 +1,7 @@
1
+ module Spice
2
+ module Html5
3
+ module Rails
4
+ VERSION = "0.0.1"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ require "spice-html5-rails/version"
2
+
3
+ module Spice
4
+ module Html5
5
+ module Rails
6
+ class Engine < ::Rails::Engine
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,25 @@
1
+ //= require spiceHTML5/enums
2
+ //= require spiceHTML5/atKeynames
3
+ //= require spiceHTML5/utils
4
+ //= require spiceHTML5/png
5
+ //= require spiceHTML5/lz
6
+ //= require spiceHTML5/quic
7
+ //= require spiceHTML5/bitmap
8
+
9
+ //= require spiceHTML5/spicedataview
10
+ //= require spiceHTML5/spicetype
11
+ //= require spiceHTML5/spicemsg
12
+ //= require spiceHTML5/wire
13
+ //= require spiceHTML5/spiceconn
14
+ //= require spiceHTML5/display
15
+ //= require spiceHTML5/main
16
+
17
+ //= require spiceHTML5/inputs
18
+ //= require spiceHTML5/cursor
19
+ //= require spiceHTML5/thirdparty/jsbn
20
+ //= require spiceHTML5/thirdparty/rsa
21
+ //= require spiceHTML5/thirdparty/prng4
22
+ //= require spiceHTML5/thirdparty/rng
23
+ //= require spiceHTML5/thirdparty/sha1
24
+
25
+ //= require spiceHTML5/ticket
@@ -0,0 +1,183 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (C) 2012 by Aric Stewart <aric@codeweavers.com>
4
+
5
+ This file is part of spice-html5.
6
+
7
+ spice-html5 is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU Lesser General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ spice-html5 is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU Lesser General Public License for more details.
16
+
17
+ You should have received a copy of the GNU Lesser General Public License
18
+ along with spice-html5. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+ /*
21
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
22
+ *
23
+ * Permission to use, copy, modify, distribute, and sell this software and its
24
+ * documentation for any purpose is hereby granted without fee, provided that
25
+ * the above copyright notice appear in all copies and that both that
26
+ * copyright notice and this permission notice appear in supporting
27
+ * documentation, and that the name of Thomas Roell not be used in
28
+ * advertising or publicity pertaining to distribution of the software without
29
+ * specific, written prior permission. Thomas Roell makes no representations
30
+ * about the suitability of this software for any purpose. It is provided
31
+ * "as is" without express or implied warranty.
32
+ *
33
+ * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
34
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
35
+ * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
36
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
37
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39
+ * PERFORMANCE OF THIS SOFTWARE.
40
+ *
41
+ */
42
+ /*
43
+ * Copyright (c) 1994-2003 by The XFree86 Project, Inc.
44
+ *
45
+ * Permission is hereby granted, free of charge, to any person obtaining a
46
+ * copy of this software and associated documentation files (the "Software"),
47
+ * to deal in the Software without restriction, including without limitation
48
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
49
+ * and/or sell copies of the Software, and to permit persons to whom the
50
+ * Software is furnished to do so, subject to the following conditions:
51
+ *
52
+ * The above copyright notice and this permission notice shall be included in
53
+ * all copies or substantial portions of the Software.
54
+ *
55
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
56
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
57
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
58
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
59
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
60
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
61
+ * OTHER DEALINGS IN THE SOFTWARE.
62
+ *
63
+ * Except as contained in this notice, the name of the copyright holder(s)
64
+ * and author(s) shall not be used in advertising or otherwise to promote
65
+ * the sale, use or other dealings in this Software without prior written
66
+ * authorization from the copyright holder(s) and author(s).
67
+ */
68
+
69
+ /*
70
+ * NOTE: The AT/MF keyboards can generate (via the 8042) two (MF: three)
71
+ * sets of scancodes. Set3 can only be generated by a MF keyboard.
72
+ * Set2 sends a makecode for keypress, and the same code prefixed by a
73
+ * F0 for keyrelease. This is a little bit ugly to handle. Thus we use
74
+ * here for X386 the PC/XT compatible Set1. This set uses 8bit scancodes.
75
+ * Bit 7 ist set if the key is released. The code E0 switches to a
76
+ * different meaning to add the new MF cursorkeys, while not breaking old
77
+ * applications. E1 is another special prefix. Since I assume that there
78
+ * will be further versions of PC/XT scancode compatible keyboards, we
79
+ * may be in trouble one day.
80
+ *
81
+ * IDEA: 1) Use Set2 on AT84 keyboards and translate it to MF Set3.
82
+ * 2) Use the keyboards native set and translate it to common keysyms.
83
+ */
84
+
85
+ /*
86
+ * definition of the AT84/MF101/MF102 Keyboard:
87
+ * ============================================================
88
+ * Defined Key Cap Glyphs Pressed value
89
+ * Key Name Main Also (hex) (dec)
90
+ * ---------------- ---------- ------- ------ ------
91
+ */
92
+
93
+ var KEY_Escape =/* Escape 0x01 */ 1
94
+ var KEY_1 =/* 1 ! 0x02 */ 2
95
+ var KEY_2 =/* 2 @ 0x03 */ 3
96
+ var KEY_3 =/* 3 # 0x04 */ 4
97
+ var KEY_4 =/* 4 $ 0x05 */ 5
98
+ var KEY_5 =/* 5 % 0x06 */ 6
99
+ var KEY_6 =/* 6 ^ 0x07 */ 7
100
+ var KEY_7 =/* 7 & 0x08 */ 8
101
+ var KEY_8 =/* 8 * 0x09 */ 9
102
+ var KEY_9 =/* 9 ( 0x0a */ 10
103
+ var KEY_0 =/* 0 ) 0x0b */ 11
104
+ var KEY_Minus =/* - (Minus) _ (Under) 0x0c */ 12
105
+ var KEY_Equal =/* = (Equal) + 0x0d */ 13
106
+ var KEY_BackSpace =/* Back Space 0x0e */ 14
107
+ var KEY_Tab =/* Tab 0x0f */ 15
108
+ var KEY_Q =/* Q 0x10 */ 16
109
+ var KEY_W =/* W 0x11 */ 17
110
+ var KEY_E =/* E 0x12 */ 18
111
+ var KEY_R =/* R 0x13 */ 19
112
+ var KEY_T =/* T 0x14 */ 20
113
+ var KEY_Y =/* Y 0x15 */ 21
114
+ var KEY_U =/* U 0x16 */ 22
115
+ var KEY_I =/* I 0x17 */ 23
116
+ var KEY_O =/* O 0x18 */ 24
117
+ var KEY_P =/* P 0x19 */ 25
118
+ var KEY_LBrace =/* [ { 0x1a */ 26
119
+ var KEY_RBrace =/* ] } 0x1b */ 27
120
+ var KEY_Enter =/* Enter 0x1c */ 28
121
+ var KEY_LCtrl =/* Ctrl(left) 0x1d */ 29
122
+ var KEY_A =/* A 0x1e */ 30
123
+ var KEY_S =/* S 0x1f */ 31
124
+ var KEY_D =/* D 0x20 */ 32
125
+ var KEY_F =/* F 0x21 */ 33
126
+ var KEY_G =/* G 0x22 */ 34
127
+ var KEY_H =/* H 0x23 */ 35
128
+ var KEY_J =/* J 0x24 */ 36
129
+ var KEY_K =/* K 0x25 */ 37
130
+ var KEY_L =/* L 0x26 */ 38
131
+ var KEY_SemiColon =/* ;(SemiColon) :(Colon) 0x27 */ 39
132
+ var KEY_Quote =/* ' (Apostr) " (Quote) 0x28 */ 40
133
+ var KEY_Tilde =/* ` (Accent) ~ (Tilde) 0x29 */ 41
134
+ var KEY_ShiftL =/* Shift(left) 0x2a */ 42
135
+ var KEY_BSlash =/* \(BckSlash) |(VertBar)0x2b */ 43
136
+ var KEY_Z =/* Z 0x2c */ 44
137
+ var KEY_X =/* X 0x2d */ 45
138
+ var KEY_C =/* C 0x2e */ 46
139
+ var KEY_V =/* V 0x2f */ 47
140
+ var KEY_B =/* B 0x30 */ 48
141
+ var KEY_N =/* N 0x31 */ 49
142
+ var KEY_M =/* M 0x32 */ 50
143
+ var KEY_Comma =/* , (Comma) < (Less) 0x33 */ 51
144
+ var KEY_Period =/* . (Period) >(Greater)0x34 */ 52
145
+ var KEY_Slash =/* / (Slash) ? 0x35 */ 53
146
+ var KEY_ShiftR =/* Shift(right) 0x36 */ 54
147
+ var KEY_KP_Multiply =/* * 0x37 */ 55
148
+ var KEY_Alt =/* Alt(left) 0x38 */ 56
149
+ var KEY_Space =/* (SpaceBar) 0x39 */ 57
150
+ var KEY_CapsLock =/* CapsLock 0x3a */ 58
151
+ var KEY_F1 =/* F1 0x3b */ 59
152
+ var KEY_F2 =/* F2 0x3c */ 60
153
+ var KEY_F3 =/* F3 0x3d */ 61
154
+ var KEY_F4 =/* F4 0x3e */ 62
155
+ var KEY_F5 =/* F5 0x3f */ 63
156
+ var KEY_F6 =/* F6 0x40 */ 64
157
+ var KEY_F7 =/* F7 0x41 */ 65
158
+ var KEY_F8 =/* F8 0x42 */ 66
159
+ var KEY_F9 =/* F9 0x43 */ 67
160
+ var KEY_F10 =/* F10 0x44 */ 68
161
+ var KEY_NumLock =/* NumLock 0x45 */ 69
162
+ var KEY_ScrollLock =/* ScrollLock 0x46 */ 70
163
+ var KEY_KP_7 =/* 7 Home 0x47 */ 71
164
+ var KEY_KP_8 =/* 8 Up 0x48 */ 72
165
+ var KEY_KP_9 =/* 9 PgUp 0x49 */ 73
166
+ var KEY_KP_Minus =/* - (Minus) 0x4a */ 74
167
+ var KEY_KP_4 =/* 4 Left 0x4b */ 75
168
+ var KEY_KP_5 =/* 5 0x4c */ 76
169
+ var KEY_KP_6 =/* 6 Right 0x4d */ 77
170
+ var KEY_KP_Plus =/* + (Plus) 0x4e */ 78
171
+ var KEY_KP_1 =/* 1 End 0x4f */ 79
172
+ var KEY_KP_2 =/* 2 Down 0x50 */ 80
173
+ var KEY_KP_3 =/* 3 PgDown 0x51 */ 81
174
+ var KEY_KP_0 =/* 0 Insert 0x52 */ 82
175
+ var KEY_KP_Decimal =/* . (Decimal) Delete 0x53 */ 83
176
+ var KEY_SysReqest =/* SysReqest 0x54 */ 84
177
+ /* NOTUSED 0x55 */
178
+ var KEY_Less =/* < (Less) >(Greater) 0x56 */ 86
179
+ var KEY_F11 =/* F11 0x57 */ 87
180
+ var KEY_F12 =/* F12 0x58 */ 88
181
+
182
+ var KEY_Prefix0 =/* special 0x60 */ 96
183
+ var KEY_Prefix1 =/* specail 0x61 */ 97
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (C) 2012 by Jeremy P. White <jwhite@codeweavers.com>
4
+
5
+ This file is part of spice-html5.
6
+
7
+ spice-html5 is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU Lesser General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ spice-html5 is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU Lesser General Public License for more details.
16
+
17
+ You should have received a copy of the GNU Lesser General Public License
18
+ along with spice-html5. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+
22
+ /*----------------------------------------------------------------------------
23
+ ** bitmap.js
24
+ ** Handle SPICE_IMAGE_TYPE_BITMAP
25
+ **--------------------------------------------------------------------------*/
26
+ function convert_spice_bitmap_to_web(context, spice_bitmap)
27
+ {
28
+ var ret;
29
+ var offset, x;
30
+ var u8 = new Uint8Array(spice_bitmap.data);
31
+ if (spice_bitmap.format != SPICE_BITMAP_FMT_32BIT &&
32
+ spice_bitmap.format != SPICE_BITMAP_FMT_RGBA)
33
+ return undefined;
34
+
35
+ ret = context.createImageData(spice_bitmap.x, spice_bitmap.y);
36
+ for (offset = 0; offset < (spice_bitmap.y * spice_bitmap.stride); )
37
+ for (x = 0; x < spice_bitmap.x; x++, offset += 4)
38
+ {
39
+ ret.data[offset + 0 ] = u8[offset + 2];
40
+ ret.data[offset + 1 ] = u8[offset + 1];
41
+ ret.data[offset + 2 ] = u8[offset + 0];
42
+
43
+ // FIXME - We effectively treat all images as having SPICE_IMAGE_FLAGS_HIGH_BITS_SET
44
+ if (spice_bitmap.format == SPICE_BITMAP_FMT_32BIT)
45
+ ret.data[offset + 3] = 255;
46
+ else
47
+ ret.data[offset + 3] = u8[offset];
48
+ }
49
+
50
+ return ret;
51
+ }
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (C) 2012 by Jeremy P. White <jwhite@codeweavers.com>
4
+
5
+ This file is part of spice-html5.
6
+
7
+ spice-html5 is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU Lesser General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ spice-html5 is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU Lesser General Public License for more details.
16
+
17
+ You should have received a copy of the GNU Lesser General Public License
18
+ along with spice-html5. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+
22
+ /*----------------------------------------------------------------------------
23
+ ** SpiceCursorConn
24
+ ** Drive the Spice Cursor Channel
25
+ **--------------------------------------------------------------------------*/
26
+ function SpiceCursorConn()
27
+ {
28
+ SpiceConn.apply(this, arguments);
29
+ }
30
+
31
+ SpiceCursorConn.prototype = Object.create(SpiceConn.prototype);
32
+ SpiceCursorConn.prototype.process_channel_message = function(msg)
33
+ {
34
+ if (msg.type == SPICE_MSG_CURSOR_INIT)
35
+ {
36
+ var cursor_init = new SpiceMsgCursorInit(msg.data);
37
+ DEBUG > 1 && console.log("SpiceMsgCursorInit");
38
+ if (this.parent && this.parent.inputs &&
39
+ this.parent.inputs.mouse_mode == SPICE_MOUSE_MODE_SERVER)
40
+ {
41
+ // FIXME - this imagines that the server actually
42
+ // provides the current cursor position,
43
+ // instead of 0,0. As of May 11, 2012,
44
+ // that assumption was false :-(.
45
+ this.parent.inputs.mousex = cursor_init.position.x;
46
+ this.parent.inputs.mousey = cursor_init.position.y;
47
+ }
48
+ // FIXME - We don't handle most of the parameters here...
49
+ return true;
50
+ }
51
+
52
+ if (msg.type == SPICE_MSG_CURSOR_SET)
53
+ {
54
+ var cursor_set = new SpiceMsgCursorSet(msg.data);
55
+ DEBUG > 1 && console.log("SpiceMsgCursorSet");
56
+ if (cursor_set.flags & SPICE_CURSOR_FLAGS_NONE)
57
+ {
58
+ document.getElementById(this.parent.screen_id).style.cursor = "none";
59
+ return true;
60
+ }
61
+
62
+ if (cursor_set.flags > 0)
63
+ this.log_warn("FIXME: No support for cursor flags " + cursor_set.flags);
64
+
65
+ if (cursor_set.cursor.header.type != SPICE_CURSOR_TYPE_ALPHA)
66
+ {
67
+ this.log_warn("FIXME: No support for cursor type " + cursor_set.cursor.header.type);
68
+ return false;
69
+ }
70
+
71
+ this.set_cursor(cursor_set.cursor);
72
+
73
+ return true;
74
+ }
75
+
76
+ if (msg.type == SPICE_MSG_CURSOR_HIDE)
77
+ {
78
+ DEBUG > 1 && console.log("SpiceMsgCursorHide");
79
+ document.getElementById(this.parent.screen_id).style.cursor = "none";
80
+ return true;
81
+ }
82
+
83
+ return false;
84
+ }
85
+
86
+ SpiceCursorConn.prototype.set_cursor = function(cursor)
87
+ {
88
+ var pngstr = create_rgba_png(cursor.header.height, cursor.header.width, cursor.data);
89
+ var curstr = 'url(data:image/png,' + pngstr + ') ' +
90
+ cursor.header.hot_spot_x + ' ' + cursor.header.hot_spot_y + ", default";
91
+ document.getElementById(this.parent.screen_id).style.cursor = curstr;
92
+ }