interrupt on tty change
This commit is contained in:
parent
0788db5a8c
commit
79166454c1
@ -23,7 +23,7 @@ driver=linux
|
||||
|
||||
[keyboard]
|
||||
keyboardLayout=desktop
|
||||
charEcho=False
|
||||
charEcho=True
|
||||
wordEcho=True
|
||||
|
||||
[general]
|
||||
|
@ -5,13 +5,13 @@ class command():
|
||||
pass
|
||||
def run(self, environment):
|
||||
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'charEcho') and\
|
||||
#len(environment['screenData']['newDelta']) <= 2 and \
|
||||
environment['screenData']['newCursor'] != environment['screenData']['oldCursor']:
|
||||
environment['screenData']['newCursor'] - environment['screenData']['oldCursor'] ==1:
|
||||
return environment
|
||||
ttyChanged = environment['screenData']['newTTY'] != environment['screenData']['oldTTY']
|
||||
if environment['screenData']['newDelta'] == environment['screenData']['oldDelta'] and \
|
||||
environment['screenData']['newTTY'] == environment['screenData']['oldTTY']:
|
||||
not ttyChanged:
|
||||
return environment
|
||||
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newDelta'],False)
|
||||
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newDelta'], ttyChanged)
|
||||
return environment
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -21,9 +21,9 @@ class fenrir():
|
||||
signal.signal(signal.SIGINT, self.captureSignal)
|
||||
|
||||
def proceed(self):
|
||||
self.threadonInput.start()
|
||||
while(self.environment['generalInformation']['running']):
|
||||
self.updateScreen()
|
||||
#self.threadonInput.start()
|
||||
#while(self.environment['generalInformation']['running']):
|
||||
self.onInput()
|
||||
self.shutdown()
|
||||
|
||||
def onInput(self):
|
||||
@ -49,8 +49,8 @@ class fenrir():
|
||||
time.sleep(0.5)
|
||||
|
||||
def handleCommands(self):
|
||||
if (self.environment['commandInfo']['currCommand'] != '') and \
|
||||
(time.time() - self.environment['commandInfo']['lastCommandTime'] >= 0.01):
|
||||
if (self.environment['commandInfo']['currCommand'] != ''):# and \
|
||||
# (time.time() - self.environment['commandInfo']['lastCommandTime'] >= 0.01):
|
||||
self.environment = self.environment['runtime']['commandManager'].executeCommand(self.environment, self.environment['commandInfo']['currCommand'], 'commands')
|
||||
|
||||
def shutdown(self):
|
||||
|
@ -4,7 +4,6 @@
|
||||
import difflib
|
||||
import textwrap
|
||||
import time
|
||||
import re
|
||||
|
||||
#import fenrir.utils.debug
|
||||
class screen():
|
||||
@ -13,12 +12,13 @@ class screen():
|
||||
self.textWrapper = textwrap.TextWrapper()
|
||||
self.textWrapper.drop_whitespace = False
|
||||
def analyzeScreen(self, environment, trigger='updateScreen'):
|
||||
# read screen
|
||||
currTTY = open('/sys/devices/virtual/tty/tty0/active','r')
|
||||
newTTY = currTTY.read()[3:-1]
|
||||
currTTY.close()
|
||||
newTTY = ''
|
||||
newContentBytes = b''
|
||||
try:
|
||||
# read screen
|
||||
currTTY = open('/sys/devices/virtual/tty/tty0/active','r')
|
||||
newTTY = currTTY.read()[3:-1]
|
||||
currTTY.close()
|
||||
vcsa = open(self.vcsaDevicePath + newTTY,'rb',0)
|
||||
newContentBytes = vcsa.read()
|
||||
vcsa.close()
|
||||
@ -26,11 +26,7 @@ class screen():
|
||||
return environment
|
||||
except:
|
||||
return environment
|
||||
if trigger != 'onInput' and False: # so we already moved the cursor and is not input -> screenUpdate was faster
|
||||
if ((newContentBytes[2] != environment['screenData']['newCursor']['x']) or\
|
||||
(newContentBytes[3] != environment['screenData']['newCursor']['y'])) and\
|
||||
(newTTY == environment['screenData']['newTTY']):
|
||||
return environment
|
||||
|
||||
# set new "old" values
|
||||
environment['screenData']['oldContentBytes'] = environment['screenData']['newContentBytes']
|
||||
environment['screenData']['oldContentText'] = environment['screenData']['newContentText']
|
||||
|
Loading…
Reference in New Issue
Block a user