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