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>
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>
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>
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>
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>
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>
- 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>
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>
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>
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>
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>
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.
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>