#if defined(WIN32)
MSG *msg = (MSG*)event;
- if ((msg->message == WM_KEYDOWN) || (msg->message == WM_SYSKEYDOWN)) {
+ if ((msg->message == WM_MOUSEMOVE) ||
+ (msg->message == WM_LBUTTONDOWN) ||
+ (msg->message == WM_LBUTTONUP) ||
+ (msg->message == WM_RBUTTONDOWN) ||
+ (msg->message == WM_RBUTTONUP) ||
+ (msg->message == WM_MBUTTONDOWN) ||
+ (msg->message == WM_MBUTTONUP) ||
+ (msg->message == WM_MOUSEWHEEL) ||
+ (msg->message == WM_MOUSEHWHEEL)) {
+ // We can't get a mouse event in the middle of an AltGr sequence, so
+ // abort that detection
+ if (self->altGrArmed)
+ self->resolveAltGrDetection(false);
+
+ return 0; // We didn't really consume the mouse event
+ } else if ((msg->message == WM_KEYDOWN) || (msg->message == WM_SYSKEYDOWN)) {
UINT vKey;
bool isExtended;
int keyCode;
// by seeing the two key events directly after each other with a very
// short time between them (<50ms) and supress the Ctrl event.
if (self->altGrArmed) {
- self->altGrArmed = false;
- Fl::remove_timeout(handleAltGrTimeout);
-
- if (isExtended && (keyCode == 0x38) && (vKey == VK_MENU) &&
- ((msg->time - self->altGrCtrlTime) < 50)) {
- // Alt seen, so this is an AltGr sequence
- } else {
- // Not Alt, so fire the queued up Ctrl event
- self->handleKeyPress(0x1d, XK_Control_L);
- }
+ bool altPressed = isExtended &&
+ (keyCode == 0x38) &&
+ (vKey == VK_MENU) &&
+ ((msg->time - self->altGrCtrlTime) < 50);
+ self->resolveAltGrDetection(altPressed);
}
if (keyCode == SCAN_FAKE) {
// We can't get a release in the middle of an AltGr sequence, so
// abort that detection
- if (self->altGrArmed) {
- self->altGrArmed = false;
- Fl::remove_timeout(handleAltGrTimeout);
- self->handleKeyPress(0x1d, XK_Control_L);
- }
+ if (self->altGrArmed)
+ self->resolveAltGrDetection(false);
if (keyCode == SCAN_FAKE) {
vlog.debug("Ignoring fake key release (virtual key 0x%02x)", vKey);
self->altGrArmed = false;
self->handleKeyPress(0x1d, XK_Control_L);
}
+
+void Viewport::resolveAltGrDetection(bool isAltGrSequence)
+{
+ altGrArmed = false;
+ Fl::remove_timeout(handleAltGrTimeout);
+ // when it's not an AltGr sequence we can't supress the Ctrl anymore
+ if (!isAltGrSequence)
+ handleKeyPress(0x1d, XK_Control_L);
+}
#endif
void Viewport::initContextMenu()