Skip to content

Support VK_PACKET in vncviewer on Windows - #2021

Open
svenssonaxel wants to merge 2 commits into
TigerVNC:masterfrom
svenssonaxel:vkpacket
Open

Support VK_PACKET in vncviewer on Windows#2021
svenssonaxel wants to merge 2 commits into
TigerVNC:masterfrom
svenssonaxel:vkpacket

Conversation

@svenssonaxel

Copy link
Copy Markdown
Contributor

No description provided.

@svenssonaxel

Copy link
Copy Markdown
Contributor Author

Squashed.
@CendioOssman ping

@CendioOssman

Copy link
Copy Markdown
Member

Sorry, I haven't had time to look at this yet. It's on my to-do list, so it's not forgotten.

@CendioOssman CendioOssman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good! There are some minor tweaks and we can get this merged.

Comment thread vncviewer/KeyboardWin32.cxx Outdated
Comment thread vncviewer/KeyboardWin32.cxx Outdated
Comment thread vncviewer/KeyboardWin32.cxx Outdated
@svenssonaxel

Copy link
Copy Markdown
Contributor Author

@CendioOssman ping

@CendioOssman

Copy link
Copy Markdown
Member

I'm unfortunately days away from my summer holiday. I'll see if I can find some time to test and merge this, but there is a risk it will have to wait until I'm back.

@CendioOssman CendioOssman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very nice. Some small stylistic fixes and then we're ready.

What good ways are there to test this?

Comment thread vncviewer/KeyboardWin32.cxx Outdated
Comment thread vncviewer/KeyboardWin32.cxx Outdated
Comment thread vncviewer/KeyboardWin32.cxx
Comment thread vncviewer/KeyboardWin32.cxx Outdated
return true;
}
else {
assert((ucsCode & 0xfc00) == 0xdc00);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this comes from Windows? We should be prepared for bugs there and not just crash. A check and return is more appropriate.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is a provable invariant. Added comments.

Comment thread vncviewer/KeyboardWin32.cxx Outdated
Comment on lines +306 to +307
vlog.error(_("Unmatched UTF-16 surrogate pair through VK_PACKET, "
"code: 0x%04x"),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's best if we can keep the strings identical to avoid burdening the translators.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Comment thread vncviewer/KeyboardWin32.h Outdated
HKL currentLayout;

bool altGrArmed;
uint32_t vkPacketHighSurrogate;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a confusing placement as it is not related to the AltGr variables above and below it.

I suggest giving it its own section below those two.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Comment thread vncviewer/keysym2ucs.c
Comment on lines +170 to +178
/* surrogates? */
if (0xd800 <= ucs && ucs <= 0xdfff)
return NoSymbol;

/* private use? */
if ((0xe000 <= ucs && ucs <= 0xf8ff) ||
(0x0f0000 <= ucs && ucs <= 0x0ffffd) ||
(0x100000 <= ucs && ucs <= 0x10fffd))
return NoSymbol;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice addition, but not strictly related to VK_PACKET? Could you put it as a separate commit?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to #2142

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait, separate commit, not PR. Fixed and force pushed.

@svenssonaxel

Copy link
Copy Markdown
Contributor Author

What good ways are there to test this?

I don't know how "good" it is, but here's the way I test it manually:

  • Connect from a Windows client, using vncviewer.exe to a VNC Server. I'm not sure how much the server matters here, but I run x11vnc + Xvfb on Debian.
  • On the Client, install Keepass and add an entry with the following password:
    !"#$%&'()*+,-./09:;<=>?@AZ[\]^_`az{|}~A"B'C^D`E~F+G𐀂H𐌼IαJωKᛟL
    
  • On the server, open any text editor.
  • Use Keypass's auto-type feature to type the password into the server.

Expected / with this fix:

  • The password is reproduced exactly on the server.

Actual / without this fix:

  • Some characters are missing or replaced with other characters.

svenssonaxel added a commit to svenssonaxel/tigervnc that referenced this pull request Aug 6, 2026
svenssonaxel added a commit to svenssonaxel/tigervnc that referenced this pull request Aug 6, 2026
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

Successfully merging this pull request may close these issues.

2 participants