[PATCH 2/2] input: define two variable conventions for input types

Kristian Høgsberg krh at bitplanet.net
Tue Dec 13 12:00:31 PST 2011


On Tue, Dec 13, 2011 at 1:50 AM, Pekka Paalanen <ppaalanen at gmail.com> wrote:
> On Mon, 12 Dec 2011 18:55:44 +0200
> Tiago Vignatti <vignatti at freedesktop.org> wrote:
>
>> From: Tiago Vignatti <tiago.vignatti at intel.com>
>>
>>     wl_input_device   → winput_dev
>>     wlsc_input_device → input_dev
>>
>> i.e. respectively type definition and variable name.
>>
>> Previously we had "device", "dev", "eid", "input_device", "wd", among
>> others to possibly describe the same type. My intention is that we
>> respect this new convention when developing from now on, so we
>> benefit from a nicer readability, easier ways to find code and
>> overall better organization.
>
> Oh yes, I like that. If I ever have free time, I'd like to do something
> similar to wl_surface, wlsc_surface, shell_surface types.

I don't like it.  First of all, I don't want a big patch to rename
everything.  For better or worse, there's a lot of naming conventions
in the code, some of them no longer in use.  For example, 'es' goes
back to when there was a glx and an egl compositor and wlsc_surface
was egl_surface.  I've refrained from these kind of global renames in
the pastWhat I do want is an agreed upon convention and then we can
change things towards as we touch the code in relation to other
changes.

Second, we have an input rewrite pending (currently what Tiago is
looking into) that is going to change the names and conventions around
a bit.  What's wl_input_device now, will be wl_input_group, and there
are going to be wl_input_pointer, wl_input_keyboard and wl_input_touch
sub-devices.  Renaming everything now only to change it again when we
land the protocol change is pointless.

Third, the proposed names are awful and there is a convention already.
 In general, the code convention in place doesn't use arbitrary
abbreviations like "dev" but tries to use the most meaningful noun
from the type name; for example, wlsc_input_device becomes 'device',
wlsc_surface becomes 'surface', wlsc_data_source becomes 'source' etc.
 In cases where we have several variables referring to the same object
as different types (wlsc_output and x11_output) we always use the most
sub-classed type (ie x11_output *output) and refer to base class
fields through this (eg output->base.compositor).  The base type in
this case is called base_output.  See x11_output_prepare_render() for
a full example.

Finally, if I sound grumpy, it's because I am.  This whole discussion
is a waste of time at a point where I personally don't have a lot of
time, and there are plenty of important things we need to move forward
with.  It's just not up for debate.

Kristian


More information about the wayland-devel mailing list