mirror of
https://github.com/brl/mutter.git
synced 2025-02-17 05:44:08 +00:00
[docs] Update the HACKING file
This commit is contained in:
parent
8aacff0e0f
commit
5e098c3886
52
HACKING
52
HACKING
@ -15,41 +15,21 @@ General notes and rules on clutter core hacking;
|
|||||||
the eventual lifetime handling of the arguments/return values or locking
|
the eventual lifetime handling of the arguments/return values or locking
|
||||||
of mutexes.
|
of mutexes.
|
||||||
|
|
||||||
- All public functions with floating point arguments should also provide a
|
|
||||||
fixed point version, with the 'x' postfix to the function name, e.g.:
|
|
||||||
|
|
||||||
clutter_actor_set_foo - floating point
|
|
||||||
clutter_actor_set_foox - fixed point
|
|
||||||
|
|
||||||
Fixed point might also be used internally if the 16.16 precision and
|
|
||||||
range allow it.
|
|
||||||
|
|
||||||
- All public functions dealing with pixels should also provide a
|
|
||||||
ClutterUnit version, with the 'u' postfix to the function name, e.g:
|
|
||||||
|
|
||||||
clutter_actor_set_bar - pixels
|
|
||||||
clutter_actor_set_baru - units
|
|
||||||
|
|
||||||
ClutterUnit should always be used internally.
|
|
||||||
|
|
||||||
- Properties should always be in floating point (never fixed point).
|
- Properties should always be in floating point (never fixed point).
|
||||||
The preferred precision is double for angles, and single precision
|
The preferred precision is double for angles, and single precision
|
||||||
for size and position -- especially if they have to be passed down
|
for size and position -- especially if they have to be passed down
|
||||||
to COGL.
|
to COGL.
|
||||||
|
|
||||||
- Properties should use pixels whenever is possible. If sub-pixel
|
- Properties should use pixels whenever is possible. Dimensional and
|
||||||
precision is fundamental, use ClutterParamSpecUnit and
|
positional properties can also use ClutterParamSpecUnits to define
|
||||||
clutter_param_spec_unit() to install ClutterUnit properties, and
|
the units-based logical values with a unit type.
|
||||||
clutter_value_set_unit()/clutter_value_get_unit() to handle GValues in
|
|
||||||
a safe way. Never install a ClutterUnit property using a GParamSpecInt,
|
|
||||||
GParamSpecFloat or GParamSpecDouble.
|
|
||||||
|
|
||||||
- Public entry points must always check their arguments with
|
- Public entry points must always check their arguments with
|
||||||
g_return_if_fail() or g_return_val_if_fail().
|
g_return_if_fail() or g_return_val_if_fail().
|
||||||
|
|
||||||
- Private entry points should use g_assert() to verify internal state;
|
- Private entry points should use g_assert() or g_warn_if_fail() to
|
||||||
do not use g_return_if_fail()/g_return_val_if_fail() as they might
|
verify internal state; do not use g_return_if_fail() or
|
||||||
be compiled out.
|
g_return_val_if_fail() as they might be compiled out.
|
||||||
|
|
||||||
- If you need to share some state variable across source files use
|
- If you need to share some state variable across source files use
|
||||||
ClutterContext and a private accessor.
|
ClutterContext and a private accessor.
|
||||||
@ -101,31 +81,13 @@ brief.
|
|||||||
[text] Emit ::cursor-event only on changes
|
[text] Emit ::cursor-event only on changes
|
||||||
|
|
||||||
The tag counts as part of overall character count, so try using
|
The tag counts as part of overall character count, so try using
|
||||||
a short word.
|
a short word. Optionally, you can also use the "tag:" form.
|
||||||
|
|
||||||
Think of the commit message as an email sent to the maintainers explaining
|
Think of the commit message as an email sent to the maintainers explaining
|
||||||
"what" you did and, more importantly, "why" you did it. The "how" is not
|
"what" you did and, more importantly, "why" you did it. The "how" is not
|
||||||
important, since "git show" will show the patch inlined with the commit
|
important, since "git show" will show the patch inlined with the commit
|
||||||
message.
|
message.
|
||||||
|
|
||||||
LANGUAGE BINDINGS
|
|
||||||
=================
|
|
||||||
|
|
||||||
- Language bindings should not wrap the fixed-point entry points of the
|
|
||||||
API; the functions that usually accept fixed-point values are convenience
|
|
||||||
functions for C developers.
|
|
||||||
|
|
||||||
- Similarly, ClutterUnit is a convenience type for the C library. It can
|
|
||||||
be safely wrapped as a floating point value, but it should be converted
|
|
||||||
to and from a floating point value using the provided macros.
|
|
||||||
|
|
||||||
- To reduce the amount of entry points, methods with the -u suffix can be
|
|
||||||
wrapped either by overloading (if your language allows it) or by making
|
|
||||||
every Unit-based function the only entry point, e.g. wrapping
|
|
||||||
clutter_actor_get_position() as accepting floating point values as
|
|
||||||
parameters and calling clutter_actor_get_positionu() internally after
|
|
||||||
having converted the argument types.
|
|
||||||
|
|
||||||
RELEASES
|
RELEASES
|
||||||
========
|
========
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user