This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: XWin design suggestion


Hi Alexander.

Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> wrote in
<Pine.LNX.4.44.0305051622580.2876-100000@odoaker.hrz.tu-chemnitz.de>
in gmane.os.cygwin.xfree on Mon, 5 May 2003 16:41:13 +0200 (MEST):

> > Traditionally Xfree86 uses /etc/X11/XF86Config for system-wide
> > settings so why not add a section there, perhaps after discussing it
> > with the rest of the XFree86 development bods? 
> Rewriting the file (and losing changes a user has made) is not an option
> for this file. 

Personally I think XWin.exe-specific stuff shouldn't be in XF86Config
anyway and certainly XWin.exe shouldn't be writing window positions to
it but I think you misunderstood what I meant.

I was suggesting that a configuration utility would read the current
contents, allow the user to change some or all the values via some
sort of GUI interface and write the whole lot back with the option of
writing back to a user-specific override file in $HOME. (/This/ file
might be used for XWin.exe state information though.)

> > Alternatively have a Cygwin-specific file, say, /etc/X11/Xcygwinrc and
> > a user-specific version $HOME/.Xcygwinrc.
> > Keep the format simple, maybe along the lines of OpenSSH with simple
> > "<keyword> <value>" pairs separated by newlines. A simple parser
> > shouldn't be too difficult to write or to snag from elsewhere, and the
> > file should be small enough to rewrite in its entirety when saving
> > changes from any GUI configuration utility. (You could use the Win32
> > INI-file API if you wanted a little more structure, although that
> > would force DOS line-endings.)

> Name it better win16 ini-file api. With win32 the registry should be used
> instead of ini-files.

For Windows applications, yes. For a POSIX-style program that stores
settings in a text file, the INI-file format is as good as any. If
someone does choose to write a Cygwin-specific program that uses this
format for a file in /etc or $HOME, then why not use the Win32
INI-file API?

> echo "Some value" > /proc/registry/HKEY_CURRENT_USER/Software/Cygnus/XFree86/TweakMe
> would be cool *g*

LOL. How about rm -fr /proc/registry/HKEY_CURRENT_USER/* too? ;-)

> I dislike having to rewrite a file where window positions 
> are stored from within Xwin because of complexity
> - race conditions
> - multi-user usage
> - multi-instance usage
> - merging of options from commandline, user config and XF86Config
> - merging into existing code
> - speed (parsing the file when a value is needed) vs complexity
>   (parsing the file at startup and access values in memory)

The Win32 registry API doesn't prevent the listed problems from
occurring either, except by using write-locking on the keys. There's
no reason why an application can't use file-locking to do the same for
a text-based data store.

Many applications read and modify their text-based configuration or
state files without these issues becoming a problem. Many ***X
applications do this for both user-modified configuration and for
programmatically maintained state. For example ncftp, openbox, bash
(.bash_history), vim, nedit, mc, ... - all of which work fine under
Cygwin.

-- 
Sam Edge


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]