Made use of internal hacked xvkbd optional. Now it is needed and

used only if the XVKBD_HACKED environment var is defined.
Made keytest.py exploit the -wait_idle option of the hacked xvkbd.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37521 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Tommaso Cucinotta 2011-02-06 22:50:07 +00:00
parent 3a6bc0b36a
commit 89620e1481
3 changed files with 26 additions and 11 deletions

View File

@ -20,7 +20,8 @@ print 'Beginning keytest.py'
FNULL = open('/dev/null', 'w')
DELAY = '59'
def_delay = '60'
key_delay = ''
class CommandSource:
@ -207,13 +208,16 @@ def sendKeystring(keystr, LYX_PID):
intr_system('import -window root '+screenshot_out+str(x.count)+".png")
time.sleep(0.1)
sys.stdout.flush()
if (subprocess.call(
[xvkbd_exe, "-no_root", "-xsendevent", "-window", lyx_window_name, "-delay", DELAY, "-text", keystr],
stdout=FNULL,stderr=FNULL
) == 0):
sys.stdout.write('*')
actual_delay = key_delay
if actual_delay == '':
actual_delay = def_delay
if not xvkbd_hacked:
subprocess.call([xvkbd_exe, "-xsendevent", "-window", lyx_window_name,
"-delay", actual_delay, "-text", keystr], stdout = FNULL, stderr = FNULL)
else:
sys.stdout.write('X')
subprocess.call([xvkbd_exe, "-no_root", "-wait_idle", lyx_pid,
"-xsendevent", "-window", lyx_window_name,
"-delay", actual_delay, "-text", keystr], stdout = FNULL, stderr = FNULL)
def system_retry(num_retry, cmd):
i = 0
@ -256,6 +260,8 @@ xvkbd_exe = os.environ.get('XVKBD_EXE')
if xvkbd_exe is None:
xvkbd_exe = "xvkbd"
xvkbd_hacked = os.environ.get('XVKBD_HACKED') != None
file_new_command = os.environ.get('FILE_NEW_COMMAND')
if file_new_command is None:
file_new_command = "\Afn"
@ -351,8 +357,8 @@ while not failed:
print 'No path /proc/' + lyx_pid + '/status, exiting'
os._exit(1)
elif c[0:4] == 'KD: ':
DELAY = c[4:].rstrip('\n')
print 'Setting DELAY to ' + DELAY + '.'
key_delay = c[4:].rstrip('\n')
print 'Setting DELAY to ' + key_delay + '.'
elif c == 'Loop':
RaiseWindow()
sendKeystring(ResetCommand, lyx_pid)

View File

@ -10,7 +10,11 @@ if [ ! -x xvkbd/xvkbd ]; then
fi
export LYX_EXE=../../../src/lyx
export XVKBD_EXE=../xvkbd/xvkbd
if [ "$XVKBD_HACKED" != "" ]; then
export XVKBD_EXE=${XVKBD:-../xvkbd/xvkbd};
fi
export KEYTEST=../keytest.py
LYX_HOME=out-home
export LYX_USERDIR=$(pwd)/$LYX_HOME/.lyx

View File

@ -22,6 +22,11 @@ if [ "$(pidof lyx)" != "" ]; then
fi
export MAX_LOOPS=1
export LYX_EXE=${LYX_EXE:-../../src/lyx}
export XVKBD_EXE=${XVKBD_EXE:-./xvkbd/xvkbd}
if [ "$XVKBD_HACKED" != "" ]; then
export XVKBD_EXE=${XVKBD_EXE:-./xvkbd/xvkbd};
else
export XVKBD_EXE=${XVKBD_EXE:-xvkbd};
fi
$KEYTEST