Calling Xrandr functions in C++ code

Younes Manton younes.m at gmail.com
Mon Nov 10 11:06:56 PST 2008


On Mon, Nov 10, 2008 at 1:02 PM, Garbs, Leigh Steven
(LARC-D107)[UNISYS CORPORATION] <Leigh.S.Garbs at nasa.gov> wrote:
> Hello all!
>
>
>
> I'm trying to use Xrandr to get a display to change resolution, refresh
> rate, and/or turn interlacing on or off, and I'd like to do this with C++.
> I've found plenty of websites with tutorials on how to do this from the
> command line, but I haven't seen anything on how to directly use Xrandr
> functions from code besides the man page.  I suppose I could try and use
> system calls to use Xrandr from the command line, but if possible I'd rather
> not.  What complicates this further is the fact that I've never done any X
> Window programming, so some of the terminology is lost on me.
>
>
>
> Is there anywhere I can go for hints on how to do this, or am I stuck with
> the man page?

Hi,

There's <X11/extensions/xrandr.h> and functions like
XRRSetScreenSize(). You can look at the source to the xrandr program
and see how it does it:

http://cgit.freedesktop.org/xorg/app/xrandr/tree/xrandr.c



More information about the xorg mailing list