[orca: 1/2] braille: remove fallback on VT 7



commit 8729cd85a56c8b463a93b721c47c873b017e7452
Author: Samuel Thibault <samuel thibault ens-lyon org>
Date:   Sun Apr 26 00:27:09 2020 +0200

    braille: remove fallback on VT 7
    
    X or Wayland is less and less actually running on VT 7. libbrlapi has been
    enhanced to ask logind which VT we are running on even when WINDOWPATH or
    XDG_VTNR is not set, so avoid interfering with that by passing a
    hardcoded VT number.
    
    At worse, users can use XDG_VTNR to override the VT number determined by
    libbrlapi.

 src/orca/braille.py  | 15 +++++++--------
 src/orca/orca.py     |  2 +-
 src/orca/settings.py |  1 -
 3 files changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/src/orca/braille.py b/src/orca/braille.py
index 5ad9fc8a5..ff4517942 100644
--- a/src/orca/braille.py
+++ b/src/orca/braille.py
@@ -1117,7 +1117,7 @@ def refresh(panToCursor=True,
 
     if len(_lines) == 0:
         if not _brlAPIRunning:
-            init(_callback, settings.tty)
+            init(_callback)
         if _brlAPIRunning:
             try:
                 _brlAPI.writeText("", 0)
@@ -1223,7 +1223,7 @@ def refresh(panToCursor=True,
 
     submask += '\x00' * (len(substring) - len(submask))
     if not _brlAPIRunning:
-        init(_callback, settings.tty)
+        init(_callback)
     if _brlAPIRunning:
         writeStruct = brlapi.WriteStruct()
         writeStruct.regionBegin = 1
@@ -1255,7 +1255,7 @@ def refresh(panToCursor=True,
             writeStruct.attrOr = submask
 
         if not _brlAPIRunning:
-            init(_callback, settings.tty)
+            init(_callback)
         if _brlAPIRunning:
             try:
                 _brlAPI.write(writeStruct)
@@ -1615,7 +1615,7 @@ def setupKeyRanges(keys):
     -keys: a list of BrlAPI commands.
     """
     if not _brlAPIRunning:
-        init(_callback, settings.tty)
+        init(_callback)
     if not _brlAPIRunning:
         return
 
@@ -1634,12 +1634,11 @@ def setupKeyRanges(keys):
 
     _brlAPI.acceptKeys(brlapi.rangeType_command, keySet)
 
-def init(callback=None, tty=7):
+def init(callback=None):
     """Initializes the braille module, connecting to the BrlTTY driver.
 
     Arguments:
     - callback: the method to call with a BrlTTY input event.
-    - tty: the tty port to take ownership of (default = 7)
     Returns False if BrlTTY cannot be accessed or braille has
     not been enabled.
     """
@@ -1680,11 +1679,11 @@ def init(callback=None, tty=7):
                     "Braille module has been initialized using XDG_VTNR=" \
                     + "%s" % vtnr)
             except:
-                _brlAPI.enterTtyMode(tty)
+                _brlAPI.enterTtyModeWithPath()
                 _brlAPIRunning = True
                 debug.println(
                     debug.LEVEL_CONFIGURATION,
-                    "Braille module has been initialized using tty=%d" % tty)
+                    "Braille module has been initialized using no WINDOWPATH or XDG_VTNR")
 
         # [[[TODO: WDW - For some reason, BrlTTY wants to say the height of the
         # Vario is 40 so we hardcode it to 1 for now.]]]
diff --git a/src/orca/orca.py b/src/orca/orca.py
index a181d5aa3..fa41b2707 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -402,7 +402,7 @@ def loadUserSettings(script=None, inputEvent=None, skipReloadMessage=False):
 
     if _settingsManager.getSetting('enableBraille'):
         try:
-            braille.init(_processBrailleEvent, settings.tty)
+            braille.init(_processBrailleEvent)
         except:
             debug.printException(debug.LEVEL_WARNING)
             msg = 'ORCA: Could not initialize connection to braille.'
diff --git a/src/orca/settings.py b/src/orca/settings.py
index 5d8e76358..691346cb3 100644
--- a/src/orca/settings.py
+++ b/src/orca/settings.py
@@ -255,7 +255,6 @@ sayAllContextList            = True
 sayAllContextTable           = True
 
 # Braille
-tty = 7
 enableBraille                  = True
 enableBrailleMonitor           = False
 enableBrailleContext           = True


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]