#13 x11vnc: Linux cursors with shadow have black border in WinXP

closed
None
5
2005-03-05
2004-12-24
No

First, I would like to thank runge and the authors of
XFIXES for finally letting me know whether my click is
going to do what I hope it will. (Such as resize a
window, or click on a hyperlink, or...) However, I
immediately noticed a minor cosmetic bug: where my
Linux cursors have transparency, my Windows client
(either TightVNC 1.2.8 or 1.3dev6) has an ugly black
border. This is the case whether or not pointer shadow
is enabled in windows and whether or not I force 8-bit
color in the TightVNC settings. It also happens with
both "Track remote cursor locally" and "Let remote
server deal with mouse cursor" modes.

If you would like, I can attach some screen shots
showing the effect.

Discussion

  • Johannes Schindelin

    • assigned_to: nobody --> runge
     
  • Karl J. Runge

    Karl J. Runge - 2004-12-24

    Logged In: YES
    user_id=219571

    > First, I would like to thank runge and the authors of
    > XFIXES for finally letting me know whether my click is
    > going to do what I hope it will. (Such as resize a
    > window, or click on a hyperlink, or...)

    I'm glad to hear it worked for you, AFAIK you're the
    1st person besides myself to test it out :-)

    I had limited access to XFIXES (had to build Xorg
    myself on Linux), coupling that with my primitive
    X environments I'm not surprised I missed this
    issue with translucent cursors.

    > However, I
    > immediately noticed a minor cosmetic bug: where my
    > Linux cursors have transparency, my Windows client
    > (either TightVNC 1.2.8 or 1.3dev6) has an ugly black
    > border. This is the case whether or not pointer shadow
    > is enabled in windows and whether or not I force 8-bit
    > color in the TightVNC settings. It also happens with
    > both "Track remote cursor locally" and "Let remote
    > server deal with mouse cursor" modes.

    You mention the Windows client, is Windows the only
    client you tried it on? I.e. does it work OK with
    a Linux client? I doubt this is the case, but I
    thought I'd ask for clarification.

    Please do attach some small, nicely cropped, screen
    shots that show the effect.

    Another thing, do you know an easy in X to get
    a cursor with transparency? My test machines
    with Xorg have no gnome or kde. Is there a way
    I can get cursor tranparency just with xsetroot(1)
    or maybe an X config file?

    We should be able to improve this (although getting
    the full transparency will probably be difficult),
    in get_xfixes_cursor() I'm doing the dumbest thing
    possible with the alpha channel:

    a = 0xff000000 & (*(xfc->pixels+i));
    a = a >> 24; /* alpha channel */

    if (a == 0) {
    bitmap[i] = ' ';
    i++;
    continue;
    } else {
    bitmap[i] = 'x';
    }

    i.e. I basically map it onto "fully-transparent" or
    "fully-opaque".

     
  • David Grossberg

    David Grossberg - 2004-12-25

    Logged In: YES
    user_id=443104

    Unfortunately, the only client(s) I have access to is
    Windows (and only when I am away from home) unless I connect
    to localhost, which while entertaining is not very
    informative.

    Also, I don't know much about plain X at all, I only
    realized that I Had a mouse cursor with transparency when
    this bug came up and I looked in the KDE control panel
    (where the attached screenshots were taken) so I'm sorry
    that I can't really help you with that. Although I did just
    find this that might help:
    http://linux.seindal.dk/item55.html (I also saw the themes
    mentioned in the link listed in the KDE control panel)

    The attached images were taken with TightVNC set to 8-bit
    color, the lilac-ish color of the background should really
    be a gray, but the important bits are there. The 'Real'
    cursor is the one under the word "theme" - the others are
    the theme preview. The selected and current theme is named
    "blueprint-cursor-theme". And the stray pixel in the first
    pic ('Active') Is part of the cursor, it's there whenever
    the cursor is the regular arrow.

     
  • Karl J. Runge

    Karl J. Runge - 2004-12-25

    Logged In: YES
    user_id=219571

    Thanks for the screen snapshots they really demonstrate the
    problem well.

    I found out how to enable translucent cursors for my simple
    setups, if
    I set XCURSOR_THEME=whiteglass before starting X (or before
    starting
    a single app) then I get the "whiteglass" style cursors;
    many have
    transparency.

    The bad news is this doesn't seem to work with the XFIXES
    aware Xorg I
    built even though that has all of the Xcursor libraries and
    "whiteglass"
    etc themes too...

    So until I get that working you can help out by downloading
    a new version
    of x11vnc and experimenting on your setup:

    http://www.karlrunge.com/x11vnc/x11vnc.c

    (and tkx11vnc.h if you want to update the gui as well). It
    has this
    new option:

    -alphacut n When using the XFIXES extension for the cursor
    shape,
    use n as a cutoff for cursors that have
    transparency
    ("alpha channel" with values ranging from 0 to
    255)
    Any cursor pixel with alpha value less than n
    becomes
    completely transparent. Otherwise the pixel is
    completely opaque. Default 255

    This lets one play with where the cutoff between transparent
    and opaque
    is. In the version you have the value is 1 (i.e. the alpha
    must be 0
    for it to be transparent, the black fuzz around your cursor
    may be small
    but not exactly zero). I believe a better choice is the
    above 255:
    only pixels marked perfectly opaque will be considered in
    the cursor
    otherwise (alpha <= 254) they are completely ignored
    (transparent).

    So please try this out and see if you can select an "n" that
    improves
    things. You can use the new remote control to do this
    without restarting,
    e.g.: x11vnc -R alphacut:128

    Hopefully that will give something usable. Longer term here
    are some
    ideas:

    1) libvncserver could probably handle an alpha
    channel in a
    rich cursor. That seems like a natural thing for
    it to do
    in these days of eye candy...

    2) If it did, it could readily handle VNC clients in
    NoCursorShapeUpdates mode, since libvncserver
    draws the cursor
    to the framebuffer for these it could do the
    blending locally.

    3) More difficult since it would require a change in
    the VNC
    protocol, would be to send the alpha channel data
    to the
    clients in CursorShapeUpdates mode and let them
    do the
    blending.

    4) Within x11vnc, it could be possible to set the
    "alphacut"
    automatically on a per cursor basis. I can't
    think of a
    good algorithm yet. I used gimp to examine the
    histogram
    of some png cursor files and the alpha values can
    get
    pretty close to 255, especially for drop shadows.
    One
    would have to look at a histogram of the alpha values
    or perhaps even more detail.

     
  • David Grossberg

    David Grossberg - 2004-12-28

    Logged In: YES
    user_id=443104

    I've been home since Christmas, so I didn't have a chance to test
    that out with a windows client, However it turns out that I was
    mistaken about connecting to localhost being uninformative, it
    actually is perfect for showing the mouse cursor. Using the
    theme I have set (and will need to reboot to change, I'll do it
    later: I have a lot running) it looks like an alphacut of about 192
    is close to perfect, 255 cuts off some of the white border around
    my pointer and 128 has some random fuzz where the shadow
    starts.

    After my next reboot I'll test some more themes. As for your
    long term ideas, I don't care about the look of my mouse pointer
    so much that I feel it's worth updating the VNC protocol, Even if
    windows actually supports semi-transparency (it might just do a
    fuzzy clone of the cursor for it's own shadow) but the default
    alphacut of 255 does seem a little high. It's a lot better then 1
    though.

     
  • Karl J. Runge

    Karl J. Runge - 2004-12-28

    Logged In: YES
    user_id=219571

    > Using the theme I have set (and will need to reboot
    > to change, I'll do it later: I have a lot running)
    > it looks like an alphacut of about 192 is close
    > to perfect, 255 cuts off some of the white border
    > around my pointer and 128 has some random fuzz
    > where the shadow starts.

    Yes, I tried 128 initially and found a lot of cursors
    were awful. Then I tried 192 as you did, but I still
    found some problems with some themes (unfortunately
    they vary quite a bit). I probably will lower it from
    255 a bit, but this leads into my next fudge factor...

    I made a 2nd experimental option -alphafrac: you
    set it to a fraction (default currently is 0.33,
    probably too low...).

    For a given cursor, a first pass is done with the
    global value of the alphacut threshold. Let N_a
    be the number of cursor pixels with non-zero alpha
    value (this is less than width*height for the cursor,
    since completely transparent pixels have alpha = 0).
    If the number of pixels selected via alphacut is
    less than alphafrac * N_a, then, for this cursor,
    the alphacut threshold is lowered until alphafrac
    fraction is reached. So this way I have it adapt
    if it is discarding too many pixels. Still a hack,
    but gives us and additional correction factor.
    Maybe most all themes can be handled by one choice
    of these two parameters...

    > After my next reboot I'll test some more themes.

    I wrote a little script that lets one look at the
    cursors quickly:

    http://www.karlrunge.com/Programs/UsefulScripts/cursorloop

    In a terminal you can do something like this:

    % env XCURSOR_THEME=whiteglass cursorloop

    you have to be able to find the theme names somewhere.
    You may also need to set XCURSOR_PATH as well if it
    can't find them.

    The drawback of this tool is that it may lead to
    wasting time on cursors that nobody uses (now I
    personally use the "gumby" cursor from time to time,
    but does anyone else!)

    > As for your long term ideas, I don't care about the
    > look of my mouse pointer so much that I feel it's
    > worth updating the VNC protocol, Even if windows
    > actually supports semi-transparency (it might
    > just do a fuzzy clone of the cursor for it's own
    > shadow) but the default alphacut of 255 does seem
    > a little high. It's a lot better then 1 though.

    I think the viewer draws the cursor into its own
    framebuffer screen, and so windows cursor support is
    not needed.

    I'm currently working on a hack. It only works
    for 32bpp at depth 24 (which is pretty common).
    It uses the extra 8 bits to store the alpha value.
    When CursorShapeUpdates is off (I think you called
    this "Let remote server deal with mouse cursor"),
    libvncserver can do it all and it looks pretty good.
    As an experiment I think I will concoct a patch to
    TightVNC unix viewer to handle the mode you called
    "Track remote cursor locally"), again 32bpp only.

    Let me know if you are interested in trying it out
    once I've got it working.

     
  • Karl J. Runge

    Karl J. Runge - 2005-03-05
    • status: open --> closed
     
  • Karl J. Runge

    Karl J. Runge - 2005-03-05

    Logged In: YES
    user_id=219571

    I'm pretty sure this is fixed well enough in x11vnc 0.7.1.
    Reopen if not.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks