if (viewOnly)
return;
- if (keyCode > 0xFFFF) {
- vlog.error(_("Too large FLTK key code %d (0x%08x)"), keyCode, keyCode);
- return;
- }
-
// Because of the way keyboards work, we cannot expect to have the same
// symbol on release as when pressed. This breaks the VNC protocol however,
// so we need to keep track of what keysym a key _code_ generated on press
// and send the same on release.
if (!down) {
- cc->writer()->keyEvent(downKeySym[keyCode], false);
+ DownMap::iterator iter;
+
+ iter = downKeySym.find(keyCode);
+ if (iter == downKeySym.end()) {
+ vlog.error(_("Unexpected release of FLTK key code %d (0x%04x)"), keyCode, keyCode);
+ return;
+ }
+
+ cc->writer()->keyEvent(iter->second, false);
+
+ downKeySym.erase(iter);
+
return;
}
#ifndef __DESKTOPWINDOW_H__
#define __DESKTOPWINDOW_H__
+#include <map>
+
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
rfb::Point lastPointerPos;
int lastButtonMask;
- rdr::U32 downKeySym[65536];
+ typedef std::map<int, rdr::U32> DownMap;
+ DownMap downKeySym;
};
#endif