]> git.lyx.org Git - features.git/commitdiff
Made use of internal hacked xvkbd optional. Now it is needed and
authorTommaso Cucinotta <tommaso@lyx.org>
Sun, 6 Feb 2011 22:50:07 +0000 (22:50 +0000)
committerTommaso Cucinotta <tommaso@lyx.org>
Sun, 6 Feb 2011 22:50:07 +0000 (22:50 +0000)
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

development/autotests/keytest.py
development/autotests/run-tests.sh
development/autotests/single-test.sh

index 748e833c96436b8ed173297c0647fa0340bfe3d4..138342f365f63cabbc158e27afb03003311ae55d 100755 (executable)
@@ -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)
index 36ab6ecb789e27181b04bec9b134d13cf2ef6247..8514aa1668794576b8acb41e0c3008ac69de3f6f 100755 (executable)
@@ -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
index 27c56cff1dd91bbc7d53f58cae54fe89720fb8f1..d5bdd872418b87ef9b5e42aeab8eeec4d23f479e 100755 (executable)
@@ -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