Re: store used VT number in a prop ?

2004-01-25 Thread Marc Aurele La France
On Sun, 25 Jan 2004, Samuel Thibault wrote:

> It's been a while since I proposed this:

> Le mar 05 aoû 2003 23:09:13 GMT, Samuel Thibault a tapoté sur son clavier :
> > We are currently developping X access to braille devices thanks to
> > gnopernicus connected to the standard text console reader brltty,
> > through BrlAPI. But for this to work (avoid conflicts with text console
> > reading), we need to know on which VT the X server is running.

> > Currently, there is no way to get this information from the server: X11
> > protocol doesn't have any native request for this. Parsing the logfile
> > like this:

> > CONTROLVT="$(grep "using VT number" "/var/log/XFree86.$(echo "$DISPLAY" | sed -e 
> > "s/^.*::*\([0-9]*\).*$/\1/").log" | sed -e "s/^.*using VT number 
> > \([0-9]*\).*$/\1/")"
> > export CONTROLVT

With a reasonably recent installation of the kbd package on Linux, it'd be
simpler to ...

export CONTROLVT=`fgconsole`

Marc.

+--+---+
|  Marc Aurele La France   |  work:   1-780-492-9310   |
|  Computing and Network Services  |  fax:1-780-492-1729   |
|  352 General Services Building   |  email:  [EMAIL PROTECTED]  |
|  University of Alberta   +---+
|  Edmonton, Alberta   |   |
|  T6G 2H1 | Standard disclaimers apply|
|  CANADA  |   |
+--+---+
XFree86 developer and VP.  ATI driver and X server internals.


___
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel


Re: store used VT number in a prop ?

2004-01-25 Thread David Dawes
On Sun, Jan 25, 2004 at 03:36:33PM -0500, David Dawes wrote:
>On Sun, Jan 25, 2004 at 02:37:00PM -0500, David Dawes wrote:
>>On Sun, Jan 25, 2004 at 07:56:11PM +0100, Samuel Thibault wrote:
>>>Le dim 25 jan 2004 18:31:17 GMT, Andrew C Aitchison a tapoté sur son clavier :
 First working hack at
http://homepage.ntlworld.com/a.c.aitchison/VTprop.patch
>>>
>>>I would rather name the property CONTROL_VT (why the "XFree86" prefix ?)
>>>
>>>It will be resetted at regeneration, won't it ?
>>>I would hence have this code go in the
>>>for (i = 0; i < xf86NumScreens; i++)
>>>loop later, or even in xf86CreateRootWindow() (which, btw, erases
>>>properties, I'm wondering how this doesn't affect your hack)
>>>
>>
>>Yes, it does get reset at regeneration, because xf86CreateRootWindow()
>>frees the properties.  The only other plaace this is currently used is
>>xf86SetDDCproperties(), and it is typically not called at server
>>regeneration either.  Perhaps xf86CreateRootWindow() needs to
>>be modified to not clear the property list?
>
>It turns out that it is more complicated than just not freeing them.
>I think that xf86RegisterRootWindowProperty() needs to be modified to
>store the information in a static form so that the properties can be
>re-created by xf86CreateRootWindow() for each generation.

The patch below handles this, and includes Andrew's patch implmenting
the VT property.  It should handle properties registered only in the
first generation and those registered each generation.

If nobody reports any problems with it, I'll commit it.

David
-- 
David Dawes
developer/release engineer  The XFree86 Project
www.XFree86.org/~dawes
Index: xf86.h
===
RCS file: /home/x-cvs/xc/programs/Xserver/hw/xfree86/common/xf86.h,v
retrieving revision 3.172
diff -u -r3.172 xf86.h
--- xf86.h  24 Sep 2003 02:43:16 -  3.172
+++ xf86.h  25 Jan 2004 20:56:19 -
@@ -57,7 +57,6 @@
 extern Bool xf86ResAccessEnter;
 extern ScrnInfoPtr *xf86Screens;   /* List of pointers to ScrnInfoRecs */
 extern const unsigned char byte_reversed[256];
-extern PropertyPtr *xf86RegisteredPropertiesTable;
 extern ScrnInfoPtr xf86CurrentScreen;
 extern Bool pciSlotClaimed;
 extern Bool isaSlotClaimed;
Index: xf86Globals.c
===
RCS file: /home/x-cvs/xc/programs/Xserver/hw/xfree86/common/xf86Globals.c,v
retrieving revision 1.41
diff -u -r1.41 xf86Globals.c
--- xf86Globals.c   24 Aug 2003 17:36:52 -  1.41
+++ xf86Globals.c   25 Jan 2004 20:47:57 -
@@ -236,7 +236,7 @@
 Bool xf86MiscModInDevDisabled = FALSE;
 Bool xf86MiscModInDevAllowNonLocal = FALSE;
 #endif
-PropertyPtr *xf86RegisteredPropertiesTable = NULL;
+RootWinPropPtr *xf86RegisteredPropertiesTable = NULL;
 Bool xf86inSuspend = FALSE;
 
 #ifdef DLOPEN_HACK
Index: xf86Helper.c
===
RCS file: /home/x-cvs/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c,v
retrieving revision 1.135
diff -u -r1.135 xf86Helper.c
--- xf86Helper.c8 Oct 2003 14:58:27 -   1.135
+++ xf86Helper.c25 Jan 2004 21:40:08 -
@@ -2888,11 +2888,12 @@
 xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
   int format, unsigned long len, pointer value )
 {
-PropertyPtr pNewProp, pRegProp;
+RootWinPropPtr pNewProp = NULL, pRegProp;
 int i;
+Bool existing = FALSE;
 
 #ifdef DEBUG
-ErrorF("xf86RegisterRootWindowProperty(%d, %d, %d, %d, %d, %p)\n",
+ErrorF("xf86RegisterRootWindowProperty(%d, %ld, %ld, %d, %ld, %p)\n",
   ScrnIndex, property, type, format, len, value);
 #endif
 
@@ -2900,19 +2901,35 @@
   return(BadMatch);
 }
 
-if ( (pNewProp = (PropertyPtr)xalloc(sizeof(PropertyRec)))==NULL ) {
-  return(BadAlloc);
+if (xf86RegisteredPropertiesTable &&
+   xf86RegisteredPropertiesTable[ScrnIndex]) {
+  for (pNewProp = xf86RegisteredPropertiesTable[ScrnIndex];
+  pNewProp; pNewProp = pNewProp->next) {
+   if (strcmp(pNewProp->name, NameForAtom(property)) == 0)
+ break;
+  }
 }
 
-pNewProp->propertyName = property;
+if (!pNewProp) {
+  if ((pNewProp = (RootWinPropPtr)xalloc(sizeof(RootWinProp))) == NULL) {
+   return(BadAlloc);
+  }
+  /*
+   * We will put this property at the end of the list so that
+   * the changes are made in the order they were requested.
+   */
+  pNewProp->next = NULL;
+} else {
+  if (pNewProp->name)
+   xfree(pNewProp->name);
+  existing = TRUE;
+}
+
+pNewProp->name = xnfstrdup(NameForAtom(property));
 pNewProp->type = type;
 pNewProp->format = format;
 pNewProp->size = len;
 pNewProp->data = value;
-/* We will put this property at the end of the list so that
- * the changes are made in the order they were requested

Re: store used VT number in a prop ?

2004-01-25 Thread David Dawes
On Sun, Jan 25, 2004 at 02:37:00PM -0500, David Dawes wrote:
>On Sun, Jan 25, 2004 at 07:56:11PM +0100, Samuel Thibault wrote:
>>Le dim 25 jan 2004 18:31:17 GMT, Andrew C Aitchison a tapoté sur son clavier :
>>> First working hack at
>>> http://homepage.ntlworld.com/a.c.aitchison/VTprop.patch
>>
>>I would rather name the property CONTROL_VT (why the "XFree86" prefix ?)
>>
>>It will be resetted at regeneration, won't it ?
>>I would hence have this code go in the
>>for (i = 0; i < xf86NumScreens; i++)
>>loop later, or even in xf86CreateRootWindow() (which, btw, erases
>>properties, I'm wondering how this doesn't affect your hack)
>>
>
>Yes, it does get reset at regeneration, because xf86CreateRootWindow()
>frees the properties.  The only other plaace this is currently used is
>xf86SetDDCproperties(), and it is typically not called at server
>regeneration either.  Perhaps xf86CreateRootWindow() needs to
>be modified to not clear the property list?

It turns out that it is more complicated than just not freeing them.
I think that xf86RegisterRootWindowProperty() needs to be modified to
store the information in a static form so that the properties can be
re-created by xf86CreateRootWindow() for each generation.

David
-- 
David Dawes
developer/release engineer  The XFree86 Project
www.XFree86.org/~dawes
___
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel


Re: store used VT number in a prop ?

2004-01-25 Thread David Dawes
On Sun, Jan 25, 2004 at 07:56:11PM +0100, Samuel Thibault wrote:
>Le dim 25 jan 2004 18:31:17 GMT, Andrew C Aitchison a tapoté sur son clavier :
>> First working hack at
>>  http://homepage.ntlworld.com/a.c.aitchison/VTprop.patch
>
>I would rather name the property CONTROL_VT (why the "XFree86" prefix ?)
>
>It will be resetted at regeneration, won't it ?
>I would hence have this code go in the
>for (i = 0; i < xf86NumScreens; i++)
>loop later, or even in xf86CreateRootWindow() (which, btw, erases
>properties, I'm wondering how this doesn't affect your hack)
>

Yes, it does get reset at regeneration, because xf86CreateRootWindow()
frees the properties.  The only other plaace this is currently used is
xf86SetDDCproperties(), and it is typically not called at server
regeneration either.  Perhaps xf86CreateRootWindow() needs to
be modified to not clear the property list?

David
-- 
David Dawes
developer/release engineer  The XFree86 Project
www.XFree86.org/~dawes
___
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel


Re: store used VT number in a prop ?

2004-01-25 Thread Andrew C Aitchison
On Sun, 25 Jan 2004, Andrew C Aitchison wrote:

> On Sun, 25 Jan 2004, Samuel Thibault wrote:
> 
> > Hi,
> > 
> > It's been a while since I proposed this:
> > 
> > Le mar 05 aoû 2003 23:09:13 GMT, Samuel Thibault a tapoté sur son clavier :
> > > We are currently developping X access to braille devices thanks to
> > > gnopernicus connected to the standard text console reader brltty,
> > > through BrlAPI. But for this to work (avoid conflicts with text console
> > > reading), we need to know on which VT the X server is running.

> First working hack at
>   http://homepage.ntlworld.com/a.c.aitchison/VTprop.patch

Which you could use with:
CONTROLVT="$(xprop -root XFree86_VT|cut -d' ' -f3)"
export CONTROLVT

> > > Currently, there is no way to get this information from the server: X11
> > > protocol doesn't have any native request for this. Parsing the logfile
> > > like this:
> > > 
> > > CONTROLVT="$(grep "using VT number" "/var/log/XFree86.$(echo "$DISPLAY" | sed -e 
> > > "s/^.*::*\([0-9]*\).*$/\1/").log" | sed -e "s/^.*using VT number 
> > > \([0-9]*\).*$/\1/")"
> > > export CONTROLVT
> > > 
> > > in the .xinitrc/.xsession is quite reliable, but a bit hairy... Dave
> > > proposed that it be recorded as a property, which is quite fine to my
> > > mind. Could this be done before 4.3.0 ?

David. I guess this is a new feature, so shouldn't go into 4.4 ?
If you do wish to allow it, where do I document it in the release notes ? 

---
This patch puts the property onto the root window of each head in a
non-Xinerama multi-head setup.

-- 
Andrew C Aitchison


___
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel


Re: store used VT number in a prop ?

2004-01-25 Thread Samuel Thibault
Le dim 25 jan 2004 18:31:17 GMT, Andrew C Aitchison a tapoté sur son clavier :
> First working hack at
>   http://homepage.ntlworld.com/a.c.aitchison/VTprop.patch

I would rather name the property CONTROL_VT (why the "XFree86" prefix ?)

It will be resetted at regeneration, won't it ?
I would hence have this code go in the
for (i = 0; i < xf86NumScreens; i++)
loop later, or even in xf86CreateRootWindow() (which, btw, erases
properties, I'm wondering how this doesn't affect your hack)

Regards,
Samuel
___
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel


Re: store used VT number in a prop ?

2004-01-25 Thread Andrew C Aitchison
On Sun, 25 Jan 2004, Samuel Thibault wrote:

> Hi,
> 
> It's been a while since I proposed this:
> 
> Le mar 05 aoû 2003 23:09:13 GMT, Samuel Thibault a tapoté sur son clavier :
> > We are currently developping X access to braille devices thanks to
> > gnopernicus connected to the standard text console reader brltty,
> > through BrlAPI. But for this to work (avoid conflicts with text console
> > reading), we need to know on which VT the X server is running.
> > 
> > Currently, there is no way to get this information from the server: X11
> > protocol doesn't have any native request for this. Parsing the logfile
> > like this:
> > 
> > CONTROLVT="$(grep "using VT number" "/var/log/XFree86.$(echo "$DISPLAY" | sed -e 
> > "s/^.*::*\([0-9]*\).*$/\1/").log" | sed -e "s/^.*using VT number 
> > \([0-9]*\).*$/\1/")"
> > export CONTROLVT
> > 
> > in the .xinitrc/.xsession is quite reliable, but a bit hairy... Dave
> > proposed that it be recorded as a property, which is quite fine to my
> > mind. Could this be done before 4.3.0 ?

First working hack at
http://homepage.ntlworld.com/a.c.aitchison/VTprop.patch

-- 
Andrew C Aitchison




___
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel


Re: store used VT number in a prop ?

2004-01-25 Thread David Dawes
On Sun, Jan 25, 2004 at 01:42:13PM +0100, Samuel Thibault wrote:
>Hi,
>
>It's been a while since I proposed this:
>
>Le mar 05 aoû 2003 23:09:13 GMT, Samuel Thibault a tapoté sur son clavier :
>> We are currently developping X access to braille devices thanks to
>> gnopernicus connected to the standard text console reader brltty,
>> through BrlAPI. But for this to work (avoid conflicts with text console
>> reading), we need to know on which VT the X server is running.
>> 
>> Currently, there is no way to get this information from the server: X11
>> protocol doesn't have any native request for this. Parsing the logfile
>> like this:
>> 
>> CONTROLVT="$(grep "using VT number" "/var/log/XFree86.$(echo "$DISPLAY" | sed -e 
>> "s/^.*::*\([0-9]*\).*$/\1/").log" | sed -e "s/^.*using VT number 
>> \([0-9]*\).*$/\1/")"
>> export CONTROLVT
>> 
>> in the .xinitrc/.xsession is quite reliable, but a bit hairy... Dave
>> proposed that it be recorded as a property, which is quite fine to my
>> mind. Could this be done before 4.3.0 ?
>> 
>> Just a reminder: the VT number is got from the os dependant part, for
>> instance lnx_init.c:90, which stores it in xf86Info.vtno. It is printed
>> in the log file (which is parsed in the ugly line above), and then never
>> used again. I've just checked in the latest cvs revision with grep
>> xf86InfoRec[^.] (and vtno, of course), only references to the
>> Documentation or the definition itself could be found, so
>> xf86InfoRec.vtno is really not given to anybody.

It is used in xfree86/common/xf86Events.c.

>And there has not been a single response. I can't think it be difficult
>to implement for anybody involved in xfree development. May anybody
>care ?

Most of us have long todo lists, so if you can come up with a
proposed patch, it is more likely that it will get done.

It should be straightforward to call xf86RegisterRootWindowProperty() with
the appropriate information at some point after xf86Info.vtno has been
initialised.  Some place after the xf86OpenConsole() call in InitOutput()
would probably work.

David
-- 
David Dawes
developer/release engineer  The XFree86 Project
www.XFree86.org/~dawes
___
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel


Re: store used VT number in a prop ?

2004-01-25 Thread Samuel Thibault
Hi,

Le dim 25 jan 2004 11:16:04 GMT, David Dawes a tapoté sur son clavier :
> >> xf86InfoRec.vtno is really not given to anybody.
> 
> It is used in xfree86/common/xf86Events.c.
> 
> >And there has not been a single response. I can't think it be difficult
> >to implement for anybody involved in xfree development. May anybody
> >care ?
> 
> Most of us have long todo lists, so if you can come up with a
> proposed patch, it is more likely that it will get done.
> 
> It should be straightforward to call xf86RegisterRootWindowProperty() with
> the appropriate information at some point after xf86Info.vtno has been
> initialised.  Some place after the xf86OpenConsole() call in InitOutput()
> would probably work.

Ok, thanks, I'll try this and come back with a patch.

Regards,
Samuel Thibault
___
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel


Re: store used VT number in a prop ?

2004-01-25 Thread Thomas Dickey
On Sun, 25 Jan 2004, Samuel Thibault wrote:

> It's been a while since I proposed this:
...
> Le mar 05 aoû 2003 23:09:13 GMT, Samuel Thibault a tapoté sur son clavier :
...
> And there has not been a single response. I can't think it be difficult
> to implement for anybody involved in xfree development. May anybody
> care ?

perhaps a patch would get more results (it's not in an area where I would
make changes, so I don't know how much work is involved, but ideas are
only a small part of the result).

-- 
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net

___
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel


Re: store used VT number in a prop ?

2004-01-25 Thread Samuel Thibault
Hi,

It's been a while since I proposed this:

Le mar 05 aoû 2003 23:09:13 GMT, Samuel Thibault a tapoté sur son clavier :
> We are currently developping X access to braille devices thanks to
> gnopernicus connected to the standard text console reader brltty,
> through BrlAPI. But for this to work (avoid conflicts with text console
> reading), we need to know on which VT the X server is running.
> 
> Currently, there is no way to get this information from the server: X11
> protocol doesn't have any native request for this. Parsing the logfile
> like this:
> 
> CONTROLVT="$(grep "using VT number" "/var/log/XFree86.$(echo "$DISPLAY" | sed -e 
> "s/^.*::*\([0-9]*\).*$/\1/").log" | sed -e "s/^.*using VT number \([0-9]*\).*$/\1/")"
> export CONTROLVT
> 
> in the .xinitrc/.xsession is quite reliable, but a bit hairy... Dave
> proposed that it be recorded as a property, which is quite fine to my
> mind. Could this be done before 4.3.0 ?
> 
> Just a reminder: the VT number is got from the os dependant part, for
> instance lnx_init.c:90, which stores it in xf86Info.vtno. It is printed
> in the log file (which is parsed in the ugly line above), and then never
> used again. I've just checked in the latest cvs revision with grep
> xf86InfoRec[^.] (and vtno, of course), only references to the
> Documentation or the definition itself could be found, so
> xf86InfoRec.vtno is really not given to anybody.

And there has not been a single response. I can't think it be difficult
to implement for anybody involved in xfree development. May anybody
care ?

Thanks,
Samuel Thibault
___
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel


store used VT number in a prop ?

2003-08-05 Thread Samuel Thibault
Hi,

We are currently developping X access to braille devices thanks to
gnopernicus connected to the standard text console reader brltty,
through BrlAPI. But for this to work (avoid conflicts with text console
reading), we need to know on which VT the X server is running.

Currently, there is no way to get this information from the server: X11
protocol doesn't have any native request for this. Parsing the logfile
like this:

CONTROLVT="$(grep "using VT number" "/var/log/XFree86.$(echo "$DISPLAY" | sed -e 
"s/^.*::*\([0-9]*\).*$/\1/").log" | sed -e "s/^.*using VT number \([0-9]*\).*$/\1/")"
export CONTROLVT

in the .xinitrc/.xsession is quite reliable, but a bit hairy... Dave
proposed that it be recorded as a property, which is quite fine to my
mind. Could this be done before 4.3.0 ?

Just a reminder: the VT number is got from the os dependant part, for
instance lnx_init.c:90, which stores it in xf86Info.vtno. It is printed
in the log file (which is parsed in the ugly line above), and then never
used again. I've just checked in the latest cvs revision with grep
xf86InfoRec[^.] (and vtno, of course), only references to the
Documentation or the definition itself could be found, so
xf86InfoRec.vtno is really not given to anybody.

Regards,
Samuel Thibault
___
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel