Mir

Code review comment for lp:~cemil-azizoglu/mir/mirsurfacespec-deprecation-2

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

*Needs Discussion*

Related to this series of MPs is the final design of our "window spec" API. It doesn't *need* to be a direct renaming of our "surface spec" API.

We have functions to:

    1. create a surface spec - mir_create_surface_spec(); and,
    2. set e.g. the type of the surface - mir_surface_spec_set_type().

We also have:

    mir_connection_create_spec_for_normal_surface()
    mir_connection_create_spec_for_menu()
    mir_connection_create_spec_for_tooltip() // *deprecated*
    mir_connection_create_spec_for_tip()
    mir_connection_create_spec_for_modal_dialog()
    mir_connection_create_spec_for_dialog()
    mir_connection_create_spec_for_input_method()

to create surfaces of *most*, but not all of the different types.

But does this redundancy really gain us anything?

Changing:

    MirSurfaceSpec *spec =
        mir_connection_create_spec_for_normal_surface(mcd.connection, 640, 480, pixel_format);
    mir_surface_spec_set_name(spec, __FILE__);

To:
    MirSurfaceSpec *spec = mir_create_window_spec(mcd.connection);
    mir_window_spec_set_type(mir_surface_type_normal);
    mir_window_spec_set_width(spec, 640);
    mir_window_spec_set_height(spec, 480);
    mir_window_spec_set_pixel_format(spec, pixel_format);
    mir_window_spec_set_name(spec, __FILE__);

May be a few more lines of downstream code, but isn't really a problem for anyone. (Especially when pixel_format ought to be optional as discussed above). And I don't really think width and height are independent. So it could be:

    MirSurfaceSpec *spec = mir_create_window_spec(mcd.connection);
    mir_window_spec_set_type(mir_surface_type_normal);
    mir_window_spec_set_size(spec, 640, spec, 480);
    mir_window_spec_set_name(spec, __FILE__);

review: Needs Information

« Back to merge proposal