Mir

Code review comment for lp:~mir-team/mir/allow-lock-surf-orientation

Revision history for this message
Alberto Aguirre (albaguirre) wrote :

> Do we have the right "orientation" here?
>
> I would guess (with insufficient data) that most apps that restrict supported
> orientations care more about landscape/portrait than they do about the angle
> from the "natural" display orientation. Forcing them to discover screen
> metrics before requesting orientation restrictions seems perverse.

One use case I was thinking about was a client may want to keep a surface in a specific orientation relative to a sensor location - say for example a flute app that requires you to blow into the mic, but perhaps if an application already has a list of sensor locations per phone model, then they should know the "natural" orientation of the screen - so portrait/landscape make sense.

So perhaps they SHOULD be separate - leave MirOrientation as is and introduce:

MirOrientationMode
{
    mir_orientation_mode_portrait = 1 << 1,
    mir_orientation_mode_landscape = 1 << 2,
    mir_orientation_mode_inverted_portrait = 1 << 3,
    mir_orientation_mode_inverted_landscape = 1 << 4,
    mir_orientation_mode_portrait_any = mir_orientation_mode_portrait | mir_orientation_mode_inverted_portrait,
    mir_orientation_mode_landscape_any = mir_orientation_mode_landscape | mir_orientation_mode_inverted_landscape,
    mir_orientation_mode_any = mir_orientation_mode_portrait_any | mir_orientation_mode_landscape_any
}

MirWaitHandle* mir_surface_set_preferred_orientation(MirSurface *surface, MirOrientationMode orientation_mode)

MirOrientationMode mir_surface_get_preferred_orientation(MirSurface *surface)

« Back to merge proposal