func initConsole() { // colbits := uint(0) XX, YY, colbits, fbmem = ker.Framebuffer() if fbmem == nil { // terminateConsole () panic("framebuffer was not initialized! (is /dev/fb0 crw-rw-rw ?)") // Speicherzugriffsfehler } maxMode = Mode(0) for { if XX == nX[maxMode] && YY == nY[maxMode] { mode = maxMode break } else if maxMode+1 < NModes { maxMode++ } else { mode = defaultMode XX, YY = nX[mode], nY[mode] break } } switch colbits { case 4, 8: colourdepth = 1 case 15, 16: colourdepth = 2 case 24: colourdepth = 3 case 32: colourdepth = 4 default: ker.Stop(pack, 100+colbits) } col.SetColourDepth(colbits) fbmemsize := nY[maxMode] * nX[maxMode] * uint(colourdepth) if uint(len(fbmem)) != fbmemsize { terminateConsole() println("len(fbmem) == ", len(fbmem), " != fbmemsize == ", fbmemsize) panic("len(fbmem) not ok !") } swFontsize(font.Normal) fbcop = make([]byte, fbmemsize) archive = make([]byte, fbmemsize) // for n:= 0; n < int(len(fbmem)) - int(colourdepth); n += int(colourdepth) { // copy (archive[n:n+int(colourdepth)], cc (col.EncodeF)) // } emptyBackground = make([]byte, fbmemsize) print(esc1 + "2J" + esc1 + "?1c" + esc1 + "?25l") Colours(col.ScreenF, col.ScreenB) initMouse() visible = true go blink() ker.InitConsole() ker.SetAction(syscall.SIGUSR1, consoleOff) ker.SetAction(syscall.SIGUSR2, consoleOn) ker.InstallTerm(terminateConsole) go ker.CatchSignals() initConsoleFonts() }
func init() { // // 0 1 2 3 4 5 6 7 8 9 // 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 bb = []byte(" 1234567890 ' qwertzuiop + asdfghjkl ^ #yxcvbnm,.- + 789-456+1230, < /") // ß ü öä bb[12] = z.Sz bb[26] = z.Ue bb[39] = z.Oe bb[40] = z.Ae // 0 1 2 3 4 5 6 7 8 9 // 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 bB = []byte(" ! $%&/()=?` QWERTZUIOP * ASDFGHJKL 'YXCVBNM;:_ * 789-456+1230, > /") // § Ü ÖÄ° bB[4] = z.Para bB[26] = z.UE bB[39] = z.OE bB[40] = z.AE bB[41] = z.Degree // 0 1 2 3 4 5 6 7 8 9 // 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 aa = []byte(" ! $%&/()=?` @WERTZUIOP ~ ASDFGHJKL 'YXCVBNM;:_ ~ {[]-456+123}, | /") // ²³ ¤ ü öä ¢ µ aa[3] = z.ToThe2 aa[4] = z.ToThe3 aa[18] = z.Euro aa[26] = z.Ue aa[39] = z.Oe aa[40] = z.Ae aa[46] = z.Copyright aa[50] = z.Mue // // 0 1 2 3 4 5 6 7 8 9 // // 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 // aA = []byte(" ! $%&/()=?` @WERTZUIOP ~ ASDFGHJKL 'YXCVBNM;:_ ~ {[]-456+123}, | /") // // ® ª ¬ ¢ º ÷ ± ¤ £ × // aA[19] = z.Registered // aA[33] = z.Female // aA[41] = z.Negate // aA[46] = z.Copyright // aA[50] = z.Male // aA[52] = z.Division // aA[73] = z.PlusMinus // aA[75] = z.Euro // aA[81] = z.Pound // aA[83] = z.Times for b := 0; b < noKeycodes; b++ { kK[b] = Esc } kK[escape] = Esc kK[f1] = Help kK[f2] = LookFor kK[f3] = Act kK[f4] = Cfg kK[f5] = Mark kK[f6] = Demark kK[f7] = Paste kK[f8] = Deposit kK[f9] = Black kK[f10] = Red kK[f11] = Green kK[f12] = Blue kK[backspace] = Back kK[tab] = Tab kK[enter] = Enter kK[print_] = PrintScr kK[pos1] = Pos1 kK[up] = Up kK[pageUp] = Up kK[left] = Left kK[right] = Right kK[end] = End kK[down] = Down kK[pageDown] = Down kK[insert] = Ins kK[delete] = Del kK[roll] = Roll kK[num7] = kK[pos1] kK[num8] = kK[up] kK[num9] = kK[pageUp] kK[num4] = kK[left] kK[num6] = kK[right] kK[num7] = kK[end] kK[num8] = kK[down] kK[num9] = kK[pageDown] kK[num0] = kK[insert] kK[numSep] = kK[delete] kK[numEnter] = kK[enter] kK[pause] = Pause kK[onOff] = OnOff kK[lower] = Lower kK[louder] = Louder text = [NComms]string{ " ", "Esc ", "Enter ", "<== ", "<- ", "-> ", "^ ", "_ ", "Pos1 ", "Ende ", "Tab ", "Entf ", "Einfg ", "F1 ", "F2 ", "F3 ", "F4 ", "F5 ", "F6 ", "F7 ", "F8 ", "F9 ", "F10 ", "F11 ", "F12 ", "drucke ", "rolle ", "Pause ", "an/aus ", "leiser ", "lauter ", "laufe ", "hier ", "ziehe ", "hierhin", "dort ", "schiebe", "dorthin", "da ", "bewege ", "dahin ", "Navigat"} lastbyte, lastcommand, lastdepth = 0, None, 0 underX = xker.Active() if underX { xpipe = make(chan xker.Event) go catchX() } else { ker.InitTerminal() ker.InstallTerm(func() { ker.TerminateTerminal() }) keypipe = make(chan byte, PIPE_BUF) if mouse.Ex() { mousepipe = mouse.Channel() } else { mousepipe = nil } navipipe = navi.Channel() go catch() } }