Verbesserungen von Chronial/Christian für kbdneo2-ahk

* Korrekte Weitergabe der Tastendrücke: Die aktuelle Version gibt für
  die betroffenen Tasten nur wiederholt kurze Tastendrücke weiter,
  anstatt korrekte keydown und keyup events zu erzeugen. Das ist gefixt

* Funktionierendes Numpad: die meisten Ebenen des Numpads gehen mit
  kbdneo2 nicht richtig. Das AHK-Script fixt jetzt auch das

* Verbesserte Bildschirmtastatur: Die Bildschirmtastatur hat schönere
  und über die Ebenen hinweg einheitlichere Grafiken und flimmert nicht
  mehr beim Wechsel zwischen Ebenen

Commit a02f3a6a2fd3f5022c1fca57aacc5edc38b868bb von https://github.com/Chronial/Neo-Ahk übernommen.
This commit is contained in:
knittl 2013-11-24 14:19:37 +00:00
parent 1357de0beb
commit ecacd1b63d
7 changed files with 274 additions and 271 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 76 KiB

View File

@ -1,10 +1,11 @@
;*********************
;*********************
; Anfangsbedingungen *
;*********************
name=Neo 2.0 (Erweiterung für nativen Treiber)
enable=Aktiviere %name%
disable=Deaktiviere %name%
#usehook on
SetKeyDelay -1
#LTrim
; *** Benutze Bilder, wenn sie im aktuellen Verzeichnis vorhanden sind ***
@ -62,8 +63,11 @@ isMod4LPressed := 0
isMod4Pressed := 0
isMod4Locked := 0
isMod4Active := 0
Ebene := 1
goto mapkeys
;***********************
; Fehlende Funktionen *
;***********************
@ -199,112 +203,204 @@ doMod4() {
}
}
; *** Funktionstasten ***
*x::
if (isMod4Active and !isMod3Pressed)
Send {Blind}{PGUP}
else
Send {Blind}x
return
*v::
if (isMod4Active and !isMod3Pressed)
Send {Blind}{BACKSPACE}
else
Send {Blind}v
return
*l::
if (isMod4Active and !isMod3Pressed)
Send {Blind}{UP}
else
Send {Blind}l
return
*c::
if (isMod4Active and !isMod3Pressed)
Send {Blind}{DEL}
else
Send {Blind}c
return
*w::
if (isMod4Active and !isMod3Pressed)
Send {Blind}{PGDN}
else
Send {Blind}w
return
*u::
if (isMod4Active and !isMod3Pressed)
Send {Blind}{HOME}
else
Send {Blind}u
return
*i::
if (isMod4Active and !isMod3Pressed)
Send {Blind}{LEFT}
else
Send {Blind}i
return
*a::
if (isMod4Active and !isMod3Pressed)
Send {Blind}{DOWN}
else
Send {Blind}a
return
*e::
if (isMod4Active and !isMod3Pressed)
Send {Blind}{RIGHT}
else
Send {Blind}e
return
*o::
if (isMod4Active and !isMod3Pressed)
Send {Blind}{END}
else
Send {Blind}o
return
*ü::
if (isMod4Active and !isMod3Pressed)
Send {esc}
else
Send {Blind}ü
return
*ö::
if (isMod4Active and !isMod3Pressed)
Send {Blind}{TAB}
else
Send {Blind}ö
return
*ä::
if (isMod4Active and !isMod3Pressed)
Send {Blind}{INS}
else
Send {Blind}ä
return
*p::
if (isMod4Active and !isMod3Pressed)
Send {ENTER}
else
Send {Blind}p
return
; Special Mapping only for z
*z::
if (isMod4Active and !isMod3Pressed)
Send ^z
else
Send {Blind}z
if (isMod4Active and !isMod3Pressed) {
if (key_z_down){
Send {Blind}{z up}
key_z_down := 0
}
Send {Blind}{Ctrl DownTemp}{z DownTemp}
key_z_down_mod := 1
} else {
if (key_z_down_mod){
Send {Blind}{Ctrl Up}{z Up}
key_z_down_mod := 0
}
Send {Blind}{z DownTemp}
key_z_down := 1
}
return
*z up::
if (key_z_down_mod){
Send {Blind}{Ctrl Up}{z Up}
key_z_down_mod := 0
}
if (key_z_down){
Send {Blind}{z up}
key_z_down := 0
}
return
; *** Mappings ***
mapkeys:
OneLayer("x", 4, "pgup")
OneLayer("v", 4, "backspace")
OneLayer("l", 4, "up")
OneLayer("c", 4, "del")
OneLayer("w", 4, "pgdn")
OneLayer("u", 4, "home")
OneLayer("i", 4, "left")
OneLayer("a", 4, "down")
OneLayer("e", 4, "right")
OneLayer("o", 4, "end")
OneLayer("ü", 4, "esc")
OneLayer("ö", 4, "tab")
OneLayer("ä", 4, "ins")
OneLayer("p", 4, "enter")
AllLayers("NumLock","tab","tab","=","","","") ; NumLock
AllLayers("NumpadDiv","NumpadDiv","NumpadDiv","÷","","","") ; NumpadDiv
AllLayers("NumpadMult","NumpadMult","NumpadMult","","×","","") ; NumpadMult
AllLayers("NumpadSub","NumpadSub","NumpadSub","","","","") ; NumpadSub
AllLayers("NumpadAdd","NumpadAdd","NumpadAdd","±","","","") ; NumpadAdd
AllLayers("Numpad7","Numpad7","","","NumpadHome","","") ; Numpad7
AllLayers("Numpad8","Numpad8","","","NumpadUp","","") ; Numpad8
AllLayers("Numpad9","Numpad9","","","NumpadPgUp","","") ; Numpad9
AllLayers("Numpad4","Numpad4","","","NumpadLeft","","") ; Numpad4
AllLayers("Numpad5","Numpad5","",":","LButton","","") ; Numpad5
AllLayers("Numpad6","Numpad6","","","NumpadRight","","") ; Numpad6
AllLayers("Numpad1","Numpad1","","","NumpadEnd","","") ; Numpad1
AllLayers("Numpad2","Numpad2","","","NumpadDown","","") ; Numpad2
AllLayers("Numpad3","Numpad3","","","NumpadPgDn","","") ; Numpad3
AllLayers("Numpad0","Numpad0","","%","NumpadIns","","") ; Numpad0
AllLayers("NumpadDot","NumpadDot",".",",","NumpadDel","","") ; NumpadDot
RemapKey("NumpadIns", "Numpad0")
RemapKey("NumpadEnd", "Numpad1")
RemapKey("NumpadDown", "Numpad2")
RemapKey("NumpadPgDn", "Numpad3")
RemapKey("NumpadLeft", "Numpad4")
RemapKey("NumpadClear", "Numpad5")
RemapKey("NumpadRight", "Numpad6")
RemapKey("NumpadHome", "Numpad7")
RemapKey("NumpadUp", "Numpad8")
RemapKey("NumpadPgUp", "Numpad9")
RemapKey("NumpadDel", "NumpadDot")
return
HookKey(key){
dnkey := "*" . key
upkey := dnkey . " up"
Hotkey,% dnkey,allstarhook
Hotkey,% upkey,allstarhook
}
OneLayer(key, layer, target){
global
HookKey(key)
CMCP%layer%%key% := target
}
AllLayers(key, e1, e2, e3, e4, e5, e6){
global
HookKey(key)
CMCP1%key% := e1
CMCP2%key% := e2
CMCP3%key% := e3
CMCP4%key% := e4
CMCP5%key% := e5
CMCP6%key% := e6
}
RemapKey(key, target){
global
HookKey(key)
KRM%key% := target
}
modeToggled:
if ((isMod3Pressed) && (isMod4Pressed || isMod4Locked)) {
Ebene := 6
} else if ((isMod3Pressed) && (isShiftPressed || isMod2Locked)) {
Ebene := 5
} else if (isMod4Active) {
Ebene := 4
} else if (isMod3Pressed) {
Ebene := 3
} else if (isShiftPressed || isMod2Locked) {
Ebene := 2
} else {
Ebene := 1
}
goto guiModeToggled
return
allstarhook:
AllStar(a_thishotkey)
return
AllStar(This_HotKey) {
global
PhysKey := This_HotKey
if (SubStr(PhysKey,1,1) == "*")
PhysKey := SubStr(PhysKey,2)
if (SubStr(PhysKey,-2) == " up") {
PhysKey := SubStr(PhysKey,1,StrLen(PhysKey)-3)
IsDown := 0
} else
IsDown := 1
RealEbene := Ebene
if (KRM%PhysKey% != ""){
PhysKey := KRM%PhysKey%
if (isMod3Pressed) {
RealEbene := 5
} else {
RealEbene := 2
}
}
Char = CP%RealEbene%%PhysKey%
if (IsDown == 1) {
CharStarDown(PhysKey, Char)
;MsgBox % This_HotKey . " -> " . PhysKey . " -> " . Char . " ---> " . "%CM" . Char . ": " . CM%Char%
} else {
CharStarUp(PhysKey)
}
}
CharStarDown(PhysKey, Char) {
global
if (CM%Char% != "") {
tosend := CM%Char%
} else {
tosend := PhysKey
}
if (PR%PhysKey% != "" && PR%PhysKey% != tosend){
CharOutUp(PR%PhysKey%)
}
CharOutDown(tosend)
PR%PhysKey% := tosend
}
CharStarUp(PhysKey) {
global
if (PR%PhysKey% != "") {
tosend := PR%PhysKey%
PR%PhysKey% := ""
CharOutUp(tosend)
}
}
CharOutDown(char){
send % "{blind}{" . char . " DownTemp}"
}
CharOutUp(char){
send % "{blind}{" . char . " Up}"
}
;*****************
; Menüfunktionen *
;*****************
@ -331,6 +427,8 @@ about:
Näheres finden Sie unter http://neo-layout.org/.
`nDieses Skript erweitert den nativen Tastaturtreiber um
einige fehlende Funktionen.
`nEs beinhaltet außerdem eine Bildschirmtastatur, die mit
Shift+Mod4+Tab geöffnet und geschlossen werden kann.
)
return
@ -367,192 +465,97 @@ return
; BildschirmTastatur *
;*********************
guiErstellt = 0
alwaysOnTop = 1
showingShift = 0
showShiftTimer = 0
showShift:
showingShift = 1
showShiftTimer = 0
goto modeToggled
return
;SetTimer, modeToggled, 1000
modeToggled:
if (isShiftPressed && !showingShift && !showShiftTimer){
SetTimer, showShift, -500
showShiftTimer = 1
} else if (!isShiftPressed){
SetTimer, showShift, Off
showingShift = 1
showShiftTimer = 0
showingShift = 0
}
;SplashTextOn, 150, 20, Button from WinLIRC, Mode Toggled
;SetTimer, SplashOff, 1000 ; This allows more signals to be processed while displaying the window.
if (guiErstellt) {
if ((isMod3Pressed) && (isMod4Pressed || isMod4Locked)) {
goto Switch6
} else if ((isMod3Pressed) && (isShiftPressed || isMod2Locked)) {
goto Switch5
} else if (isMod4Active) {
goto Switch4
} else if (isMod3Pressed) {
goto Switch3
} else if (showingShift || isMod2Locked) {
goto Switch2
} else {
goto Switch1
goto modeToggled
return
guiModeToggled:
; This shift logic delays the display of layer 2,
; so the keyboard doesnt constantly flash during
; normal typing
if (isShiftPressed && !showingShift && !showShiftTimer){
SetTimer, showShift, -300
showShiftTimer = 1
} else if (!isShiftPressed){
SetTimer, showShift, Off
showShiftTimer = 0
showingShift = 0
}
if (guiErstellt) {
guiEbene := Ebene
if (guiEbene = 2 && !showingShift)
guiEbene = 1
goto UpdateImage
}
}
return
SplashOff:
SplashTextOff
return
*F1::
if (isMod4Pressed&&zeigeBildschirmTastatur)
goto Switch1
else send {blind}{F1}
return
*F2::
if (isMod4Pressed&&zeigeBildschirmTastatur)
goto Switch2
else send {blind}{F2}
return
*F3::
if (isMod4Pressed&&zeigeBildschirmTastatur)
goto Switch3
else send {blind}{F3}
return
*F4::
if (isMod4Pressed&&zeigeBildschirmTastatur)
goto Switch4
else send {blind}{F4}
return
*F5::
if (isMod4Pressed&&zeigeBildschirmTastatur)
goto Switch5
else send {blind}{F5}
return
*F6::
if (isMod4Pressed&&zeigeBildschirmTastatur)
goto Switch6
else send {blind}{F6}
return
*F7::
if (isMod4Pressed&&zeigeBildschirmTastatur)
goto Show
else send {blind}{F7}
if (isMod4Pressed && zeigeBildschirmTastatur)
goto Show
else send {blind}{F7}
return
*F8::
if (isMod4Pressed&&zeigeBildschirmTastatur)
goto ToggleAlwaysOnTop
else send {blind}{F8}
return
Switch1:
tImage := "ebene1.png"
goto Switch
Return
Switch2:
tImage := "ebene2.png"
goto Switch
Return
Switch3:
tImage := "ebene3.png"
goto Switch
Return
Switch4:
tImage := "ebene4.png"
goto Switch
Return
Switch5:
tImage := "ebene5.png"
goto Switch
Return
Switch6:
tImage := "ebene6.png"
goto Switch
Return
Switch:
if guiErstellt {
if (Image = tImage) {
;goto Close
} else {
Image := tImage
SetTimer, Refresh
}
} else {
Image := tImage
goto Show
}
Return
Show:
if guiErstellt {
goto Close
} else {
if (Image = "") {
Image := "ebene1.png"
}
yPosition := A_ScreenHeight -270
Gui,Color,FFFFFF
Gui,Add,Picture, AltSubmit BackgroundTrans xm ym vPicture,%Image% ;
Gui,+AlwaysOnTop
Gui +LastFound
WinSet, TransColor, FFFFFF
Gui -Caption +ToolWindow
Gui,Show,NA y%yposition% Autosize
OnMessage(0x201, "WM_LBUTTONDOWN")
OnMessage(0x203, "WM_LBUTTONDBLCLK")
guiErstellt = 1
}
if guiErstellt {
goto Close
} else {
if (Image = "") {
Image := "ebene1.png"
}
yPosition := A_ScreenHeight -270
Gui,Color,FFFFFF
Gui,Add,Picture, AltSubmit BackgroundTrans xm ym hwndHPIC vPicture,%Image% ;
Gui,+AlwaysOnTop
Gui +LastFound
WinSet, TransColor, FFFFFF
Gui -Caption +ToolWindow
Gui,Show,NA y%yposition% Autosize
OnMessage(0x201, "WM_LBUTTONDOWN")
OnMessage(0x203, "WM_LBUTTONDBLCLK")
GuiControlGet, P, Pos, Picture
loop, 6 {
HBITMAP%A_Index% := LoadImage("ebene" . A_Index . ".png", PW, PH)
}
guiErstellt = 1
}
Return
WM_LBUTTONDOWN()
{
PostMessage, 0xA1, 2
LoadImage(ImagePath, W, H) {
; Each GUI window may have up to 11,000 controls. However, use caution when creating more
; than 5000 controls because system instability may occur for certain control types.
Gui, 99:Add, Pic, w%W% h%H% AltSubmit hwndHPIC, %ImagePath%
SendMessage, 0x0173, 0, 0, , ahk_id %HPIC% ; STM_GETIMAGE
Return ErrorLevel
}
WM_LBUTTONDBLCLK()
{
SetTimer, Close, -1
UpdateImage:
if (guiEbeneShown != guiEbene){
SendMessage, 0x0172, 0, HBITMAP%guiEbene%, , ahk_id %HPIC% ; STM_SETIMAGE
DeleteObject(ErrorLevel)
guiEbeneShown := guiEbene
}
Return
DeleteObject(hObject) {
return DllCall("DeleteObject", "uint", hObject)
}
WM_LBUTTONDOWN() {
PostMessage, 0xA1, 2
}
WM_LBUTTONDBLCLK() {
SetTimer, Close, -1
}
Close:
guiErstellt = 0
Gui,Destroy
guiErstellt = 0
Gui,Destroy
Gui, 99:Destroy
Return
Refresh:
If (Image != OldImage) {
GuiControl,,Picture,%Image%
OldImage := Image
}
Return
ToggleAlwaysOnTop:
if alwaysOnTop {
Gui, -AlwaysOnTop
alwaysOnTop = 0
} else {
Gui, +AlwaysOnTop
alwaysOnTop = 1
}
Return