#159 Patch to make AltGr work

open
nobody
None
5
2014-08-16
2008-09-23
No

I have a custom keyboard layout, created with Microsoft Keyboard Layout Creator, that uses the right alt key as a mode switch. For example, RightAlt+8 yields infinity. It wasn’t working properly in rdesktop. The problem turned out to be that rdesktop maintains its own notion of remote modifier state that it enforces on keypresses. The AltGr key in Windows is equivalent to pressing Ctrl-Alt, so doing

Press AltGr
Press 8
Release 8
Release AltGr

should yield (as Spy++ running in the mstsc client shows)

WM\_KEYDOWN VK\_CONTROL
WM\_KEYDOWN VK\_MENU \(aka alt\)
WM\_KEYDOWN '8'
WM\_KEYUP       '8'
WM\_SYSKEYUP    VK\_CONTROL
WM\_KEYUP       VK\_MENU

but rdesktop was clearing the modifier state right before the '8' and restoring it afterwards, so it was coming out

\# Press AltGr
WM\_KEYDOWN VK\_CONTROL
WM\_KEYDOWN VK\_MENU
\# Press '8' \(restore modifier state first\)
WM\_SYSKEYUP    VK\_CONTROL
WM\_KEYUP   VK\_MENU
WM\_KEYDOWN '8'
\# Restore modifier state?
WM\_KEYDOWN VK\_CONTROL
WM\_KEYDOWN VK\_MENU
WM\_KEYUP   '8'
\# Release AltGr
WM\_SYSKEYUP    VK\_CONTROL
WM\_KEYUP   VK\_MENU

Now since AltGr wasn’t pressed when '8' was pressed, it came out as a regular '8' instead of infinity. Furthermore, whether Right Alt translates to Ctrl-Alt depends on the current keyboard layout of the thread currently holding the input focus, which rdesktop can’t know about.

The attached patch just removes everything to do with tracking the remote modifier state. It generates the correct message sequence for the RightAlt+8 case, and all my mode-shifted keys work properly now.

Discussion

  • Anonymous - 2008-09-23
     
  • Nobody/Anonymous

    U7arZ1 <a href="http://dkmgcowsodah.com/">dkmgcowsodah</a>, [url=http://wwvlnbgrakgs.com/]wwvlnbgrakgs[/url], [link=http://mamftqxrtdhl.com/]mamftqxrtdhl[/link], http://pedzhmfiauqb.com/

     

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

Sign up for the SourceForge newsletter:





No, thanks