From 7d651d312803034c59894b069aebc8c20725c075 Mon Sep 17 00:00:00 2001 From: knittl Date: Sun, 24 Nov 2013 14:19:37 +0000 Subject: Verbesserungen von Chronial/Christian für kbdneo2-ahk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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. git-svn-id: https://svn.neo-layout.org@2440 b9310e46-f624-0410-8ea1-cfbb3a30dc96 --- .../Treiber/AHK_f\303\274r_kbdneo2/ebene1.png" | Bin 32930 -> 76169 bytes .../Treiber/AHK_f\303\274r_kbdneo2/ebene2.png" | Bin 32467 -> 78628 bytes .../Treiber/AHK_f\303\274r_kbdneo2/ebene3.png" | Bin 32787 -> 72480 bytes .../Treiber/AHK_f\303\274r_kbdneo2/ebene4.png" | Bin 33034 -> 75082 bytes .../Treiber/AHK_f\303\274r_kbdneo2/ebene5.png" | Bin 34785 -> 77673 bytes .../Treiber/AHK_f\303\274r_kbdneo2/ebene6.png" | Bin 33245 -> 77793 bytes .../Treiber/AHK_f\303\274r_kbdneo2/kbdneo2.ahk" | 513 +++++++++++---------- 7 files changed, 258 insertions(+), 255 deletions(-) (limited to 'windows') diff --git "a/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/ebene1.png" "b/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/ebene1.png" index a75bc67..7b98480 100644 Binary files "a/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/ebene1.png" and "b/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/ebene1.png" differ diff --git "a/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/ebene2.png" "b/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/ebene2.png" index 185f8ff..6e65acc 100644 Binary files "a/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/ebene2.png" and "b/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/ebene2.png" differ diff --git "a/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/ebene3.png" "b/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/ebene3.png" index 6654a93..d560be6 100644 Binary files "a/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/ebene3.png" and "b/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/ebene3.png" differ diff --git "a/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/ebene4.png" "b/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/ebene4.png" index c86b07a..d4ea7ae 100644 Binary files "a/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/ebene4.png" and "b/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/ebene4.png" differ diff --git "a/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/ebene5.png" "b/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/ebene5.png" index d6e0cc6..6c5b483 100644 Binary files "a/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/ebene5.png" and "b/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/ebene5.png" differ diff --git "a/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/ebene6.png" "b/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/ebene6.png" index cbe3f86..9a6d2a3 100644 Binary files "a/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/ebene6.png" and "b/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/ebene6.png" differ diff --git "a/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/kbdneo2.ahk" "b/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/kbdneo2.ahk" index 4567ac7..1b7e669 100644 --- "a/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/kbdneo2.ahk" +++ "b/windows/kbdneo2/Treiber/AHK_f\303\274r_kbdneo2/kbdneo2.ahk" @@ -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,7 +63,10 @@ isMod4LPressed := 0 isMod4Pressed := 0 isMod4Locked := 0 isMod4Active := 0 +Ebene := 1 + +goto mapkeys ;*********************** ; Fehlende Funktionen * @@ -199,111 +203,203 @@ 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 +; Special Mapping only for z -*c:: -if (isMod4Active and !isMod3Pressed) - Send {Blind}{DEL} -else - Send {Blind}c +*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 -*w:: -if (isMod4Active and !isMod3Pressed) - Send {Blind}{PGDN} -else - Send {Blind}w +*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 -*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 +; *** 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 +} -*a:: -if (isMod4Active and !isMod3Pressed) - Send {Blind}{DOWN} -else - Send {Blind}a -return +OneLayer(key, layer, target){ + global + HookKey(key) + CMCP%layer%%key% := target +} -*e:: -if (isMod4Active and !isMod3Pressed) - Send {Blind}{RIGHT} -else - Send {Blind}e -return +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 +} -*o:: -if (isMod4Active and !isMod3Pressed) - Send {Blind}{END} -else - Send {Blind}o -return +RemapKey(key, target){ + global + HookKey(key) + KRM%key% := target +} -*ü:: -if (isMod4Active and !isMod3Pressed) - Send {esc} -else - Send {Blind}ü -return +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 + } + } -*ö:: -if (isMod4Active and !isMod3Pressed) - Send {Blind}{TAB} -else - Send {Blind}ö -return + Char = CP%RealEbene%%PhysKey% + if (IsDown == 1) { + CharStarDown(PhysKey, Char) + ;MsgBox % This_HotKey . " -> " . PhysKey . " -> " . Char . " ---> " . "%CM" . Char . ": " . CM%Char% + } else { + CharStarUp(PhysKey) + } +} -*ä:: -if (isMod4Active and !isMod3Pressed) - Send {Blind}{INS} -else - Send {Blind}ä -return +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 +} -*p:: -if (isMod4Active and !isMod3Pressed) - Send {ENTER} -else - Send {Blind}p -return +CharStarUp(PhysKey) { + global + if (PR%PhysKey% != "") { + tosend := PR%PhysKey% + PR%PhysKey% := "" + CharOutUp(tosend) + } +} -*z:: -if (isMod4Active and !isMod3Pressed) - Send ^z -else - Send {Blind}z -return +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 - } + goto modeToggled +return + +guiModeToggled: + ; This shift logic delays the display of layer 2, + ; so the keyboard doesn’t constantly flash during + ; normal typing + if (isShiftPressed && !showingShift && !showShiftTimer){ + SetTimer, showShift, -300 + showShiftTimer = 1 + } else if (!isShiftPressed){ + SetTimer, showShift, Off + 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 + 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} -return - -*F8:: - if (isMod4Pressed&&zeigeBildschirmTastatur) - goto ToggleAlwaysOnTop - else send {blind}{F8} + if (isMod4Pressed && zeigeBildschirmTastatur) + goto Show + else send {blind}{F7} 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 +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 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 -Switch6: - tImage := "ebene6.png" - goto Switch -Return +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 +} -Switch: - if guiErstellt { - if (Image = tImage) { - ;goto Close - } else { - Image := tImage - SetTimer, Refresh +UpdateImage: + if (guiEbeneShown != guiEbene){ + SendMessage, 0x0172, 0, HBITMAP%guiEbene%, , ahk_id %HPIC% ; STM_SETIMAGE + DeleteObject(ErrorLevel) + guiEbeneShown := guiEbene } - } 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 - } -Return +DeleteObject(hObject) { + return DllCall("DeleteObject", "uint", hObject) +} -WM_LBUTTONDOWN() -{ - PostMessage, 0xA1, 2 +WM_LBUTTONDOWN() { + PostMessage, 0xA1, 2 } -WM_LBUTTONDBLCLK() -{ - SetTimer, Close, -1 +WM_LBUTTONDBLCLK() { + SetTimer, Close, -1 } Close: - guiErstellt = 0 - Gui,Destroy -Return - -Refresh: - If (Image != OldImage) { - GuiControl,,Picture,%Image% - OldImage := Image - } -Return - -ToggleAlwaysOnTop: - if alwaysOnTop { - Gui, -AlwaysOnTop - alwaysOnTop = 0 - } else { - Gui, +AlwaysOnTop - alwaysOnTop = 1 - } + guiErstellt = 0 + Gui,Destroy + Gui, 99:Destroy Return - -- cgit v1.2.3