XServer Switching resolution and refresh rate
Hello Linux-Gurus!
I want to change the resolution and refresh rate used by a XServer
from within a java programm. The user should be able to choose between
some predefined sets.
Like in Sax/Sax2 it should be possible to test the new resolution
before writing the config-file.
Does anyone know if this is possible without rewriting SaX or
XFree86Config ;-). I could think of some simple command-line remote
controlable script or programm which I could use from within the java
programm.
Any idea is welcome!
Thanks,
Tobias
Re: XServer Switching resolution and refresh rate
On 13 Jul 2004 13:48:23 -0700, Tobias Koch staggered into the Black Sun
and said:[color=blue]
> I want to change the resolution and refresh rate used by a XServer
> from within a java program.[/color]
You can't do this very easily from Java, for obvious reasons. Your best
bet is to write this program in C or C++ since all the core functions of
X are in C (big surprise, eh?) Java's platform/hardware independence
works against it here, since switching video modes is *very* platform
and hardware dependent. Use the right tool for the job.
[color=blue]
> Like in Sax/Sax2 it should be possible to test the new resolution
> before writing the config-file.[/color]
Check the source for xvidtune. It's in the X430src-2.tgz tarball. Also
do "apropos XF86" since most of the functions you'll need to call, like
XF86VidModeSwitchToMode , start with XF86.
[color=blue]
> I could think of some simple command-line remote controlable script or
> program which I could use from within the java programm.[/color]
xvidtune is probably what you're looking for. There's no way to specify
a new modeline to xvidtune right now, but you can use that program to
adjust existing modelines or switch among modelines that are already
defined.
--
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin / mail: TRAP + SPAN don't belong
[url]http://www.brainbench.com[/url] / Hire me!
-----------------------------/ [url]http://crow202.dyndns.org/~mhgraham/resume[/url]
Re: XServer Switching resolution and refresh rate
Dances With Crows wrote:[color=blue]
> Check the source for xvidtune. It's in the X430src-2.tgz tarball. Also
> do "apropos XF86" since most of the functions you'll need to call, like
> XF86VidModeSwitchToMode , start with XF86.[/color]
What do you mean by "apropos XF86"?
[color=blue][color=green]
> > I could think of some simple command-line remote controlable script or
> > program which I could use from within the java programm.[/color]
>
> xvidtune is probably what you're looking for. There's no way to specify
> a new modeline to xvidtune right now, but you can use that program to
> adjust existing modelines or switch among modelines that are already
> defined.[/color]
Thanks for the tip. I tried xvidtune. I seems to be the right tool for
the job. I could 'remote control' it by a runtime.exec command in
java.
But there is something strange with it: xvidtune doesn't seem to read
XF86Config and XF86Config-4. It cycles just between 4 modes and
doesn't care about how I edit XF86Config and XF86Config-4.
Also "xvidtune -next -timeout 3" doesn't work, it takes only one
option.
Any idea?
regards,
Tobias
By the way: how come your answer was written before I asked the
question? ;-)
Re: XServer Switching resolution and refresh rate
On 14 Jul 2004 01:30:58 -0700, Tobias Koch staggered into the Black Sun
and said:[color=blue]
> Dances With Crows wrote:[color=green]
>> Also do "apropos XF86" since most of the functions you'll need to
>> call, like XF86VidModeSwitchToMode , start with XF86.[/color]
> What do you mean by "apropos XF86"?[/color]
Open an xterm/konsole and type "apropos XF86" at the prompt. You'll get
a list of man pages that have the string "XF86" in their descriptions.
Since almost every C function that exists has a man page, apropos is
extremely useful.
[color=blue][color=green]
>> xvidtune is probably what you're looking for. There's no way to
>> specify a new modeline to xvidtune right now, but you can use that[/color]
> Thanks for the tip. I tried xvidtune. I seems to be the right tool for
> the job. I could 'remote control' it by a runtime.exec command in
> java.
>
> But there is something strange with it: xvidtune doesn't seem to read
> XF86Config and XF86Config-4. It cycles just between 4 modes and
> doesn't care about how I edit XF86Config and XF86Config-4.[/color]
xvidtune doesn't parse the XF86Config file. It queries the X server for
modelines. Remember that you have to restart X after modifying the
XF86Config file, since that file is only read at X startup.
[color=blue]
> Also "xvidtune -next -timeout 3" doesn't work, it takes only one
> option. Any idea?[/color]
That's by design. Look at xvidtune.c around line 1548 and it'll all
become clear. If you want different behavior, you'll have to modify
xvidtune's C code and recompile.
[color=blue]
> By the way: how come your answer was written before I asked the
> question?[/color]
Time zones. Gotta love 'em.
--
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin / mail: TRAP + SPAN don't belong
[url]http://www.brainbench.com[/url] / Hire me!
-----------------------------/ [url]http://crow202.dyndns.org/~mhgraham/resume[/url]