NumLock and CapsLock check for windows
This commit is contained in:
parent
4a38af8535
commit
5e98241df1
|
|
@ -79,9 +79,30 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
unsigned short sel;
|
||||
static int capslock = 0;
|
||||
static int numlock = 0;
|
||||
XKeyboardState kbdstate;
|
||||
|
||||
state &=~Mod2Mask; /* 20170511 filter out NumLock status */
|
||||
#ifndef __unix__
|
||||
short cstate = GetKeyState(VK_CAPITAL);
|
||||
short nstate = GetKeyState(VK_NUMLOCK);
|
||||
if (capslock==0 && (cstate&0x0001)) {
|
||||
tcleval(".statusbar.8 configure -state active -text {CAPS LOCK SET! }");
|
||||
capslock = 1;
|
||||
}
|
||||
if (capslock==1 && !(cstate&0x0001)) {
|
||||
if (numlock) tcleval(".statusbar.8 configure -state active -text {NUM LOCK SET! }");
|
||||
else tcleval(".statusbar.8 configure -state normal -text {}");
|
||||
capslock = 0;
|
||||
}
|
||||
if(numlock==0 && (nstate&0x0001)) {
|
||||
tcleval(".statusbar.8 configure -state active -text {NUM LOCK SET! }");
|
||||
numlock = 1;
|
||||
}
|
||||
if (numlock==1 && !(nstate&0x0001)) {
|
||||
if(capslock) tcleval(".statusbar.8 configure -state active -text {CAPS LOCK SET! }");
|
||||
else tcleval(".statusbar.8 configure -state normal -text {}");
|
||||
numlock = 0;
|
||||
}
|
||||
#else
|
||||
XKeyboardState kbdstate;
|
||||
XGetKeyboardControl(display, &kbdstate);
|
||||
if(capslock == 0 && (kbdstate.led_mask & 1)) {
|
||||
tcleval(".statusbar.8 configure -state active -text {CAPS LOCK SET! }");
|
||||
|
|
@ -101,7 +122,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
else tcleval(".statusbar.8 configure -state normal -text {}");
|
||||
numlock = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
if(semaphore)
|
||||
{
|
||||
if(debug_var>=2)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
v {xschem version=2.9.5_RC6 file_version=1.1}
|
||||
G {type=logo
|
||||
v {xschem version=2.9.7 file_version=1.2}
|
||||
G {}
|
||||
K {type=logo
|
||||
template="name=l1 author=\\"Stefan Schippers\\" rev=1.0"
|
||||
verilog_ignore=true
|
||||
vhdl_ignore=true
|
||||
|
|
@ -24,5 +25,5 @@ T {SCHEM} 165 -25 0 0 1 1 {}
|
|||
T {@time_last_modified} 2750 -60 0 0 0.8 0.8 {}
|
||||
T {@author} 2120 -140 0 0 0.8 0.8 {}
|
||||
T {Page @page of @pages} 2120 -60 0 0 0.8 0.8 {}
|
||||
T {@title} 2750 -140 0 0 0.8 0.8 {}
|
||||
T {@title} 2750 -120 0 0 0.6 0.6 {vcenter=true}
|
||||
T {Rev. @rev} 2460 -60 0 0 0.8 0.8 {}
|
||||
|
|
|
|||
Loading…
Reference in New Issue