Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

character input display upside down #22

Open
dns007 opened this issue Nov 17, 2016 · 2 comments
Open

character input display upside down #22

dns007 opened this issue Nov 17, 2016 · 2 comments

Comments

@dns007
Copy link

dns007 commented Nov 17, 2016

Hi, when I connect to Centos 7 , the characters input in terminal display upside down .but refresh the page the characters display normal , why?
Thanks.
333

@jsaathof
Copy link

Same with me. I am running websockify on openSUSE Leap 15. I have read about a patch in the spice-html5 client for fixing topdown rendering.

@doccaz
Copy link

doccaz commented Feb 7, 2019

I found this particularly annoying while dealing with text-mode.

I noticed that the original spice5-html had this issue as well, and it was fixed in this patch:
https://cgit.freedesktop.org/~pgrunt/spice-html5/commit/?h=topdown

... which if I understood correctly, is just implementing a "topdown" (e.g. invert the coordinates for drawing) on a particular packet type/color depth, SPICE_SURFACE_FMT_32_xRGB.

Looking through the sources for the eyeOS web client, I found this in lib/images/bitmap.js:

                if(!topdown) {
                        ret = wdi.RasterOperation.flip(ret);
                }

Looking further up, we find the part of the code that deals with 32-bit color packets. It's called wdi.SpiceBitmapFmt.SPICE_BITMAP_FMT_32BIT here.
To fix it, just add a " topdown = true" statement:

                      if (type === wdi.SpiceBitmapFmt.SPICE_BITMAP_FMT_32BIT) {
                                // FIX: setting topdown to TRUE avoids the "flip screen" effect on text modes
                                topdown = true;
                                for (pos = 0; pos < size; pos += 4) {
                                        b = data[pos];
                                        data[pos] = data[pos + 2];
                                        data[pos + 2] = b;
                                        data[pos + 3] = 255;
                                }

Will do a pull request later (if they're ever going to accept them, that's another story -- some have been in queue for two years).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants