XServer Switching resolution and refresh rate - X

This is a discussion on XServer Switching resolution and refresh rate - X ; 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 ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: XServer Switching resolution and refresh rate

  1. 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

  2. Re: XServer Switching resolution and refresh rate

    On 13 Jul 2004 13:48:23 -0700, Tobias Koch staggered into the Black Sun
    and said:
    > I want to change the resolution and refresh rate used by a XServer
    > from within a java program.


    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.

    > Like in Sax/Sax2 it should be possible to test the new resolution
    > before writing the config-file.


    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.

    > I could think of some simple command-line remote controlable script or
    > program which I could use from within the java programm.


    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
    http://www.brainbench.com / Hire me!
    -----------------------------/ http://crow202.dyndns.org/~mhgraham/resume

  3. Re: XServer Switching resolution and refresh rate

    Dances With Crows wrote:
    > 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.

    What do you mean by "apropos XF86"?

    > > I could think of some simple command-line remote controlable script or
    > > program which I could use from within the java programm.

    >
    > 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.

    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? ;-)

  4. Re: XServer Switching resolution and refresh rate

    On 14 Jul 2004 01:30:58 -0700, Tobias Koch staggered into the Black Sun
    and said:
    > Dances With Crows wrote:
    >> Also do "apropos XF86" since most of the functions you'll need to
    >> call, like XF86VidModeSwitchToMode , start with XF86.

    > What do you mean by "apropos XF86"?


    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.

    >> 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

    > 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.


    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.

    > Also "xvidtune -next -timeout 3" doesn't work, it takes only one
    > option. Any idea?


    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.

    > By the way: how come your answer was written before I asked the
    > question?


    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
    http://www.brainbench.com / Hire me!
    -----------------------------/ http://crow202.dyndns.org/~mhgraham/resume

+ Reply to Thread