Skip to content

Commit 9a76d44

Browse files
committed
Faker: Ignore Num Lock state w/ popup key sequence
Referring to 4a75e02 (2.0 beta1) and 7dbdbdc (2.1), the VirtualGL Faker's event handler historically matched both Mod1Mask and Mod2Mask in the modifier state to an Alt key sequence in VGL_GUI. In the dawn of time (AKA 2000 and late), that was correct, because Mod2Mask was used for the right Alt key. In 2025, however, Mod2Mask is used for Num Lock, and either Mod1Mask (Linux, FreeBSD) or Mod5Mask (Solaris 11) is used for the right Alt key. Thus, the modifier state will always contain Mod2Mask if Num Lock is on, so the event handler's previous logic never matched fconfig.guimod in that case. Since we don't support Solaris anymore and fconfig.guimod will only ever contain ShiftMask, ControlMask, or Mod1Mask, the correct modern solution is to mask off all other bits in the modifier state before comparing it to fconfig.guimod.
1 parent 41c5789 commit 9a76d44

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ the X keyboard extension was enabled on the 2D X server.
1717
other elements of the Firefox browser window to disappear when the window was
1818
resized.
1919

20+
5. Fixed an issue whereby the VirtualGL Configuration dialog did not pop up if
21+
the Num Lock key was on.
22+
2023

2124
2.6.6 ESR
2225
=========

server/faker-x11.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright (C)2004 Landmark Graphics Corporation
22
// Copyright (C)2005, 2006 Sun Microsystems, Inc.
3-
// Copyright (C)2009, 2011-2016, 2018-2023 D. R. Commander
3+
// Copyright (C)2009, 2011-2016, 2018-2023, 2025 D. R. Commander
44
//
55
// This library is free software and may be redistributed and/or modified under
66
// the terms of the wxWindows Library License, Version 3.1 or (at your option)
@@ -674,16 +674,11 @@ static void handleEvent(Display *dpy, XEvent *xe)
674674
}
675675
else if(xe && xe->type == KeyPress)
676676
{
677-
unsigned int state2, state = (xe->xkey.state & (~(LockMask))) & 0xFF;
678-
state2 = fconfig.guimod;
679-
if(state2 & Mod1Mask)
680-
{
681-
state2 &= (~(Mod1Mask)); state2 |= Mod2Mask;
682-
}
677+
unsigned int state =
678+
xe->xkey.state & (ShiftMask | ControlMask | Mod1Mask);
683679
if(fconfig.gui
684680
&& KeycodeToKeysym(dpy, xe->xkey.keycode, 0) == fconfig.guikey
685-
&& (state == fconfig.guimod || state == state2)
686-
&& fconfig_getshmid() != -1)
681+
&& state == fconfig.guimod && fconfig_getshmid() != -1)
687682
VGLPOPUP(dpy, fconfig_getshmid());
688683
}
689684
else if(xe && xe->type == ClientMessage)

0 commit comments

Comments
 (0)