From 5e98241df13f1b0929d4646a9d88b36edd984923 Mon Sep 17 00:00:00 2001 From: Stefan Schippers Date: Tue, 22 Sep 2020 21:02:51 +0200 Subject: [PATCH] NumLock and CapsLock check for windows --- src/callback.c | 27 ++++++++++++++++++++++++--- xschem_library/devices/title-2.sym | 7 ++++--- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/callback.c b/src/callback.c index d4b5f365..ecbb608d 100644 --- a/src/callback.c +++ b/src/callback.c @@ -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) diff --git a/xschem_library/devices/title-2.sym b/xschem_library/devices/title-2.sym index 5b6c2bbf..d8c39b4d 100644 --- a/xschem_library/devices/title-2.sym +++ b/xschem_library/devices/title-2.sym @@ -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 {}