Commit Graph

154 Commits

Author SHA1 Message Date
Rafael Gieschke
6672c678db HACK: force VP9 2024-10-11 14:30:46 +02:00
zengdongbao
f279fe81fa optimized wire.js inbound function, reduce combine times
If the frame data is large, it will be divided into multiple packets. In the current processing mode, each packet will be merged with the old packet into a new buffer, resulting in a large number of redundant operations.
Optimization scheme: Use array cache packets, and finally use DataView.set to do a merge.

After testing, 1080p picture data merging time can be reduced from 100ms to <5ms

Signed-off-by: zengdongbao <zengdongbao@gmail.com>
2024-01-17 09:29:03 +00:00
David Edler
9c8377f86c fix keyboard mappings for international keyboard layouts
Key presses by a client with an international keyboard layout will often fail.
I.e. the key AltGr creates an error message "No mapping for key 255". This key is important to produce the @ symbol i.e. on German language keyboard. The currently used e.keyCode differs by browser vendor and is ambiguous for some keys.
This change relies instead on the event.code, which is stable for most common keys and more complete.
I keep the old implementation to rely on e.keyCode as a fallback if the e.code is not available or the mapping for it is missing.

See merge request spice/spice-html5!14

Signed-off-by: David Edler <david.edler@canonical.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2024-01-06 12:44:17 +00:00
Jonathan Race
56ddb3005e addition of ctrl-alt-delete functionality on side navigation, with associated js eventlistener 2020-09-04 15:37:00 -04:00
Jonathan Race
480441dbf4 Style updates to include layout structure, side navigation, hidden menu, consolidation of formatting, button effects, and color shift 2020-09-04 15:34:25 -04:00
Oliver Gutierrez
02084ebd19 Added needed import of function arraybuffer_to_str
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-07-02 16:51:25 +01:00
Jeremy White
e2dec1cea4 Make an attempt to follow the rules on auto play videos.
Browsers have stopped allowing auto play videos.  The documented solution
is to mute your video.  This patch mutes our videos and also attempts to
start playing if the auto play does not fire.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-04-09 09:13:16 +01:00
Jeremy White
2c36a2474b Allow pointer events to go through our videos.
If a video covers up a substantial portion of the screen,
you can no longer interact with it.

This change allows pointer events to flow through to our canvas.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-04-07 10:13:00 +01:00
Jeremy White
8b238f0eeb Make the audio and video uids different.
This does not appear to matter, but let's just be safe.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-04-07 10:08:44 +01:00
Jeremy White
4dc2401b75 Review the webm video track header and remove the fixmes.
This involved a review of the Firefox parsing code along
with the official specifcation, and setting these fields
to the specified default values.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-04-07 10:08:41 +01:00
Jeremy White
e1da56fe93 Bug fix: non square cursors were drawn improperly. 2020-01-13 10:14:43 -06:00
Joel Purra
e10791b986 Check if streams array exists in handle_draw_jpeg_onload
- It seems `SpiceDisplayConn` does not always have the array `this.o.sc.streams` set.
- It also seems (stream?) images can be loaded before `streams` is set.
- Without `streams`, or the specific stream matching `this.o.id`, `this.o.sc.streams[this.o.id].frames_loading` cannot be accessed.
- The check for the specific stream woth `this.o.id` is already in place, this patch adds a check for `this.o.sc.streams` in `handle_draw_jpeg_onload`.
- There might be a better place to ensure that `this.o.sc.streams` is initialized; this quick fix saved my bacon today though.

Might be related to, and perhaps fix:

- https://bugs.freedesktop.org/show_bug.cgi?id=94776
- https://bugzilla.redhat.com/show_bug.cgi?id=1323144

Signed-off-by: Joel Purra <mig@joelpurra.se>
2019-12-31 11:18:08 -06:00
Jeremy White
5fae52199b Merge branch 'fix-ctrl-alt-delete' into 'master'
Add the sc object to sendCtrlAltDel because it is otherwise undefined and issues a JS error

See merge request spice/spice-html5!2
2019-08-23 18:03:37 +00:00
Paul Hodges IV
1cc7987360 Add the sc object to sendCtrlAltDel because it is otherwise undefined and issues a JS error 2019-08-20 14:34:16 +00:00
Frediano Ziglio
87b9bee02f Fix double string termination in HTML page
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2019-08-06 12:45:18 +01:00
Jeremy White
61373be8ec Adjust the presentation of two byte scan codes.
The previous implementation worked strictly due to a bug which would
luckily generate roughly the right scan codes, although we would send
more codes than required.

For example, the old implementation would send 0xdf48e0 for 'up key down'
and '0xdfc8e0' for 'up key up'.  The prepended 0xdf is incorrect; the
correct values should be 0x48e0 and 0xc8e0.  Essentially, it stored
the bytes in reverse order and had a bug while flipping them.

This code stores them in the order we transmit them which simplifies
the code.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-08-06 10:36:34 +01:00
Jeremy White
a14f8933a7 Update the documentation and organization of the scancodes.
The common scan codes were disjointed and logically belong together.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-08-06 10:36:31 +01:00
Jeremy White
bd96ebe0a9 Support the keypad minus key in Chrome.
The keypad minus key at 109 is common between at least Chrome and Firefox.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-08-06 10:36:28 +01:00
Jeremy White
c4e5fd1c3e Use a named constant from atKeynames.js for the PrintScreen/SysRq key.
Correct a typo from the upstream atKeynames.js at the same time.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-08-06 10:36:26 +01:00
Cédric Bosdonnat
54755c2565 More reliable mouse position reporting
Depending on the structure of the page, the computed mouse position was
not correct. Typically the case happend when there is no offset between
the canvas and the view area, but an offset on the view area.

The MouseEvent.offsetX and offsetY functions are now widely enough spread
to use them and avoid complex computations.
2019-02-15 10:06:21 -06:00
Jeremy White
d75dc56440 Hide the message console by default. 2019-02-14 12:47:06 -06:00
Jeremy White
a2d39ea672 Fix the console toggle in the new ES6 environment.
Signed-off-by: Jeremy White <jwhite@codeweavers.com>
2019-02-14 12:47:04 -06:00
Jeremy White
fa63a5392d Generate package.json from the Makefile.
Signed-off-by: Jeremy White <jwhite@codeweavers.com>
2019-02-14 12:46:44 -06:00
Cédric Bosdonnat
8ab92d030e resize_helper: round sizes down
If we round up, we may end up with a display slightly bigger than what
the window can have, thus adding scroll bars. When rounding down we
avoid this problems.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
2019-02-14 12:46:13 -06:00
Cédric Bosdonnat
7b8f595b8f resize_helper, no message box case
The resize_handler need to check for the existence of the message box
before computing it's size.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
2019-02-14 12:46:11 -06:00
Cédric Bosdonnat
ee0ec7c24f Document onsuccess callback
Signed-off-by: Jeremy White <jwhite@codeweavers.com>
2019-02-14 12:46:10 -06:00
Cédric Bosdonnat
dfa40a73ff Prompt password in spice_auto.html
In case the user didn't provide any password, we want to prompt him for
it. Try once and if we get an permission denied error, then ask the
password and retry to connect.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
2019-02-14 12:46:09 -06:00
Cédric Bosdonnat
df374203dd Fix disconnect() code
The disconnect() function were not checking the existence of the file
transfer area element, leading to stop the disconnect() before its end.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
2019-02-14 12:46:08 -06:00
Cédric Bosdonnat
ef82543195 Move sources into their own folder
To add some more order to the folder, move the JS files into their own
src folder.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
2019-02-14 12:46:07 -06:00
Cédric Bosdonnat
77e448a72d Prepare publishing on npmjs
Add package.json needed to publish on npmjs.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
2019-02-14 12:46:06 -06:00
Cédric Bosdonnat
7f5b9f54a5 Expose all needed pieces in main.js
We don't want the users to rely on anything else than main.js. All the
helper functions from the other files are thus imported in main and
exported there too.

This way all the user needs to import is:

    import * as SpiceHtml5 from './main.js';

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
2019-02-14 12:46:05 -06:00
Cédric Bosdonnat
c5e9fe00e9 Remove duplicated enums
Signed-off-by: Jeremy White <jwhite@codeweavers.com>
2019-02-14 12:46:04 -06:00
Cédric Bosdonnat
2c08f20c25 Introduce ES6 modules
Avoid cluttering the global namespace. Use ES6 modules in order to
to this.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
2019-02-14 12:46:02 -06:00
Jeremy White
2fe0aed39d Convert sha1.js line endings to Unix.
Signed-off-by: Jeremy White <jwhite@codeweavers.com>
2019-02-14 12:46:01 -06:00
Cédric Bosdonnat
629edd57b6 CSS: don't force the background color or inputs
When forcing the background of the input fields, this makes them
unreadable for dark themed browsers.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
2019-02-14 12:45:57 -06:00
Christophe Fergeau
f9f700ee54 display: Only use display channel with id 0
spice-html5 does not support multiple display channels, and will only
use the first one offered by spice-server, and ignore the others. This
can cause issues when using a VM with a configured but unused
org.spice-space.stream.0 spice port as this will create a 'fake' display
channel which is offered by spice-server before the usual qxl display
channel.
This commit favours the display channel with id 0 rather than picking
the first one.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-07-19 14:43:39 +02:00
Christophe Fergeau
969fe1fb68 display: Dump bitmap metadata in log_draw()
log_draw() is used to debug drawing commands by dumping drawing
information to the JS console. This commit adds dumping of missing data
for uncompressed bitmaps. The 'stride' parameter is important, as
spice-html5 currently does not deal properly with such bitmaps.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Jeremy White <jwhite@codeweavers.com>
2018-07-18 09:12:43 +01:00
Tomáš Bohdálek
fb21664f6b Add checkbox to toggle debug console
This allows show or hide debug console under spice screen.
2017-06-22 12:54:20 +02:00
Tomáš Bohdálek
556ed82aa4 Always show debug console
Make sure to show both screen and console.
2017-06-02 09:45:35 -05:00
Pavel Grunt
7ba763feb5 Handle non topdown bitmaps 2017-03-07 15:11:44 -06:00
Vincent Desprez
bfa85a7117 Handling non-topdown lz_rgb
Signed-off-by: Vincent Desprez <vincent.desprez@apwise.com>
2017-03-07 15:11:15 -06:00
Jeremy White
2fa7c65144 When offered multiple heads, generate a warning, rather than failing in subtle ways. 2017-03-07 13:29:25 -06:00
Jeremy White
4ea12e87a2 Only drop an mjpeg frame if we are not currently processing one. 2017-01-20 09:58:03 -06:00
Jeremy White
368fdaf51d Disable the onload function when clearing the image source.
This fixes a bug introduced by my commit 42134d3e, which would
lead to an infinite recursion of onload statements.
2017-01-20 09:55:12 -06:00
Jeremy White
d83dc14e15 Detect video underrun and advance the current time.
This helps us avoid stalled video streams.
2017-01-20 09:50:45 -06:00
Jeremy White
001bcc830f Add more stream information in high debug situations at an updateend event. 2017-01-20 09:50:42 -06:00
Jeremy White
aa8e9ecb79 Catch and note updateend messages after video destruction. 2017-01-20 09:50:35 -06:00
Jeremy White
564461259f Condense the playback queue before adding to the Media Buffer.
This helps Firefox in situations where the incoming traffic
is preventing the audio element from processing data quickly enough.
2017-01-10 11:24:29 -06:00
Jeremy White
a770272e7d Include the codec type in the stream creation message. 2016-12-15 10:45:58 -06:00
Jeremy White
b3a3a20d15 Move the queue length debug up to stream level 2.
It's a fair amount of noise, and not useful at level 1.
2016-12-15 10:45:57 -06:00