Sonntag, 3. Juli 2011

Interesting & ugly stuff

The last few days I've been working on implementing copyArea acceleration, which is really a useful feature for faster scrolling. Instead of re-painting the whole scrolled area, only a small image of the "uncovered" are is sent to the browser - while the content already on screen is simply moved.
Supporting accelerated operations like this required quite a bit of tinkering with the code-base - accalerated operations require invalidated regions to be preserved before (which is why it wouldn't be wise to accelerate other primitives like fillRect too).
Long talk ... it still needs more work, because there are still artifacts. Other than that I am pleased with the performance results.

Now the ugly - keyboard events for now only work for basic characters on german keyboards.
Browsers are really broken in this regard. Sometimes the same keyCode is generated for different keys, sometimes keys can only differentiate by the order the keyPressed/Typed/Released events are generated.
All this is of course highly browser specific and without having an idea what keyboard layout is used actually, there isn't really a cure for the mess. Not so great idea to make a scripted document viewer the dominant runtime for distributed applications :/
Thanks a lot to the Joel Martin (Author of noVNC) who allows me to base my code on top of noVNC's input handling.


cl333r hat gesagt…

In Gnome/cairo if you use a Gtk::DrawingArea widget inside a scrolled pane you only get repaint events with the coordinates for the uncovered area and it's up to the client (programmer) to decide if he wants to repaint the whole area or only the uncovered one.
I didn't know that Java doesn't work as well.

There's no such word "accaleration", only "acceleration".

Linuxhippy hat gesagt…

Thats exactly the way it works for java - but the cacio-web backend for now sends down the whole area to the browser.

I already have some code, just need to get it working ;)