Hi all,

As noted in #2527, the keyboard demo fails to pick up the right shift 
key, instead claiming it to be a left shift.
This is because lParam&(1<<24) is 0 for the shift key, and only the 
shift key, though I've no idea why this is the case (it *is* noted in 
the keyboard demo as a known bug of Windows - at least, on 2.0).
Now, I'm no Windows API guru, thus my posting here. A quick patch to fix 
this is as follows:

Index: src/Fl_win32.cxx
===================================================================
--- src/Fl_win32.cxx    (revision 8393)
+++ src/Fl_win32.cxx    (working copy)
@@ -976,10 +976,10 @@
         break;
    case WM_KEYDOWN:
    case WM_SYSKEYDOWN:
+    // save the keysym until we figure out the characters:
+    Fl::e_keysym = Fl::e_original_keysym = 
ms2fltk(wParam,(lParam&(1<<24)) || GetAsyncKeyState(VK_RSHIFT));
    case WM_KEYUP:
    case WM_SYSKEYUP:
-    // save the keysym until we figure out the characters:
-    Fl::e_keysym = Fl::e_original_keysym = ms2fltk(wParam,lParam&(1<<24));
      // See if TranslateMessage turned it into a WM_*CHAR message:
      if (PeekMessageW(&fl_msg, hWnd, WM_CHAR, WM_SYSDEADCHAR, PM_REMOVE))
      {



The problem I have with a patch like this, aside from the fact that it's 
more of a hack than a patch, is that it no longer modifies the keysym on 
KEYUP events, which I'm guessing was intentional behaviour.
In any case, is anyone able to shed some light on this issue, or comment 
on the validity of the above patch either way?

Regards,
Ben

_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to