mir/xrandr compatibility lib

Bryce Harrington bryce at canonical.com
Mon Apr 8 19:20:38 UTC 2013

I'm looking into making a wrapper lib for mir that provides a few basic
xrandr operations via mir.  I think I understand what's needed but want
to get your sanity check before I get too far into it.

This mir/randr compatibility library ("mirandr?") will provide the
header file X11/extensions/Xrandr.h, but stripped down to only the RANDR
1.0 routines and structure definitions.  That should be adequate for
applications and is a reasonably achievable subset (i.e. no multi-head
layout operations, properties, or other advanced stuff).  Since
libXrandr is in C, this will need to be in C as well.

The library will provide mir implementations of these commonly needed
RANDR 1.0 calls:

  XRRQueryVersion()    // Just returns 1.0
  XRRQueryExtension()  // Stub; just return true

The getter call (retrieving read-only information) is the immediate
priority.  The setter routine may be more involved to get right so
implementaton will be left to phase 2.

There are also a number of accessors and constructor/destructor routines
for the various structs.  These are entirely local (they don't make any
server calls) so will be reused as-is.

The implementation of XRRGetScreenInfo() will essentially just set up a
mir connection, grab the display info, and reformat it into the Xrandr
structures.  So, borrowing logic from the demo client, it'd look
something like:

    MirConnection* connection{nullptr};
    mir_wait_for(mir_connect(mir_test_socket, __PRETTY_FUNCTION__,
                 connection_callback, &connection));
    MirDisplayInfo info;
    mir_connection_get_display_info(connection, &info);

    // Create XRRScreenConfiguration structure
    // Copy info.width, info.height to structure

    // return structure

How's this all sound so far?


More information about the Mir-devel mailing list