[BRLTTY] Brltty for Windows and reading of non-focused window

Samuel Thibault samuel.thibault at ens-lyon.org
Tue May 13 13:56:23 EDT 2008


Jan Mura, le Fri 09 May 2008 11:45:14 +0200, a écrit :
> I think static select is enough for now.

Ok, here is a patch.
Maybe something else than "followfocus" could be used for the name of
the option.

Samuel
-------------- next part --------------
diff -ur brltty/ScreenDrivers/Windows/screen.c /home/samy/win/brltty/ScreenDrivers/Windows/screen.c
--- brltty/ScreenDrivers/Windows/screen.c	2008-02-04 18:30:58.000000000 +0100
+++ brltty/ScreenDrivers/Windows/screen.c	2008-05-13 19:46:26.000000000 +0200
@@ -22,10 +22,11 @@
 #include "sys_windows.h"
 
 typedef enum {
-  PARM_ROOT
+  PARM_ROOT,
+  PARM_FOLLOWFOCUS
 } ScreenParameters;
-#define SCRPARMS "root"
-static unsigned int root;
+#define SCRPARMS "root", "followfocus"
+static unsigned int root, followfocus;
 
 #include "scr_driver.h"
 
@@ -40,6 +41,12 @@
     if (!validateYesNo(&root, parameters[PARM_ROOT]))
       LogPrint(LOG_WARNING, "%s: %s", "invalid root setting", parameters[PARM_ROOT]);
   }
+  if (*parameters[PARM_FOLLOWFOCUS]) {
+    if (!AttachConsoleProc)
+      LogPrint(LOG_WARNING, "No need for followfocus BRLTTY on systems that do not support AttachConsole()");
+    if (!validateYesNo(&followfocus, parameters[PARM_FOLLOWFOCUS]))
+      LogPrint(LOG_WARNING, "%s: %s", "invalid root setting", parameters[PARM_ROOT]);
+  }
   return 1;
 }
 
@@ -82,7 +89,7 @@
 
 static int
 construct_WindowsScreen (void) {
-  if (AttachConsoleProc || root) {
+  if (followfocus && (AttachConsoleProc || root)) {
     /* disable ^C */
     SetConsoleCtrlHandler(NULL,TRUE);
     if (!FreeConsole() && GetLastError() != ERROR_INVALID_PARAMETER)
@@ -128,7 +135,7 @@
 currentVirtualTerminal_WindowsScreen (void) {
   HWND win;
   altTab = NULL;
-  if ((AttachConsoleProc || root) && GetAltTabInfoAProc) {
+  if (followfocus && (AttachConsoleProc || root) && GetAltTabInfoAProc) {
     altTabInfo.cbSize = sizeof(altTabInfo);
     EnumWindows(findAltTab, 0);
     if (altTab) {
@@ -146,7 +153,7 @@
     unreadable = "root BRLTTY";
     goto error;
   }
-  if (AttachConsoleProc && !tryToAttach(win)) {
+  if (followfocus && AttachConsoleProc && !tryToAttach(win)) {
     unreadable = "no terminal to read";
     goto error;
   }
--- brltty/Documents/brltty.conf.in	2008-02-29 21:09:46.000000000 +0100
+++ /home/samy/win/brltty/Documents/brltty.conf.in	2008-05-13 19:54:54.000000000 +0200
@@ -389,5 +389,6 @@
 
 # Windows Screen Driver Parameters
 #screen-parameters wn:Root=no # [no,yes]
+#screen-parameters wn:FollowFocus=yes # [no,yes]
 
 


More information about the BRLTTY mailing list