We still ship clutter_get_show_fps() and clutter_get_debug_enabled() as
public entry points. Yet another case of missing API review prior to the
1.0 release, so really the bucket stops around my desk.
Let's deprecate these two useless functions, and reduce the API
footprint of Clutter.
This function should have never been made public in the first place; its
output depends on a configuration option of Clutter, and it's basically
useful only for internal debugging.
Setting the default frame rate does not do anything even remotely
useful, unless synchronization to the vertical refresh rate is also
disabled - which can only be done through environment variable or
through configuration file. Having a programmatic way to change the
default frame rate is, thus, completely pointless.
Changing the default frame rate through environment variable and
configuration file is still allowed.
The number of deprecations in clutter-main.h makes the header harder to
parse, and more confusing. We can use a separate header under the
deprecated subdirectory to hold all the deprecated symbols.
Just like GLIB_DEPRECATED and GLIB_DEPRECATED_FOR, Clutter should have
its own wrappers for G_DEPRECATED and G_DEPRECATED_FOR, to allow opting
out of deprecation warnings.
Deprecation warnings are enabled by default, now, even when building
Clutter.
We already have two mechanisms for controlling the font rendering
quality on a per-application basis:
• ClutterSettings properties
• clutter_backend_set_font_options()
The font flags were always a stop-gap solution, and one that tried to
simplify a fairly complex issue beyond the point of actually being
useful.
https://bugzilla.gnome.org/show_bug.cgi?id=660786
The grab API is a relic of Clutter 0.6, and hasn't been through proper
vetting in a *long* time — mostly due to the fact that we don't really
like grabs, and point to the ::captured-event as a way to implement
"soft grabs" in toolkits and applications.
The implementation of full and device grabs uses weak references on
actors instead of using the ::destroy signal, which is meant exactly for
the case of releasing pointers to actors when they are disposed.
The API naming scheme is also fairly broken, especially for
device-related grabs.
Finally, keyboard device grabs are just not implemented.
We can, in one go, clean up this mess and deprecate a bunch of badly
named API by introducing generic device grab/ungrab methods on
ClutterInputDevice, and re-implement the current API on top of them.
GLib deprecated g_thread_init(), and threading support is initialized
by GObject, so Clutter already runs with threading support enabled. We
can drop the clutter_threads_init() call requirement, and initialize the
Big Clutter Lock™ on clutter_init(). This reduces the things that have
to be done when dealing with threads with Clutter, and the things that
can possibly go wrong.
Complete the quest of commit bc548dc862
by making the ClutterStage methods for controlling the per-actor motion
and crossing event delivery public, and deprecating the global ones.
Many people expect clutter_init to work the same way as gtk_init which
exits the program on init failure. clutter_init however returns a
status code on failure which applications need to handle because if
the init fails then any further Clutter calls are likely to crash. In
Clutter 2.0 we may want to change this to be more like GTK+.
http://bugzilla.clutter-project.org/show_bug.cgi?id=2574
This time, in Clutter core.
The ObjC standard library provides a type called 'id', which obviously
requires any library to either drop the useful shadowed variable warning
or stop using 'id' as a variable name.
Yes, it's almost unbearably stupid. Well, at least it's not 'index' in
string.h, or 'y2' in math.h.
Initialize the accessibility support calling cally_accessibility_init
Take into account that this is required to at least be sure that
CallyUtil class is available.
It also modifies cally_accessibility_module_init in order to return
if the initialization was fine (and the name, removing the module word).
It also removes the gnome accessibility hooks, as it is not anymore
module code.
Solves CB#2098
Instead of using PangoDirection directly we should use the
ClutterTextDirection enumeration.
We also need a pair of accessor functions for setting and
getting the default text direction.
Change CLUTTER_PRIORITY_REDRAW to be lower than the GTK+ resize
and relayout priorities to avoid starving GTK+ when run in the
same process as clutter.
Remove the unused CLUTTER_PRIORITY_TIMELINE
http://bugzilla.openedhand.com/show_bug.cgi?id=1637
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Instead of trying to guess about which motion events are
extraneous, queue up all events until we process a frame.
This allows us to look ahead and reliably compress consecutive
sequence of motion events.
clutter-main.c: Feed received events to the stage for queueing.
Remove old compression code. Remove clutter_get_motion_events_frequency()
clutter_set_motion_events_frequency()
clutter-stage.c: Keep a queue of pending events.
clutter-master-clock.c: Add processng of queued events to the
clock source dispatch function.
http://bugzilla.openedhand.com/show_bug.cgi?id=1637
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Sometimes it is necessary for third party code to have a
function called during the redraw process, so that you can
update the scenegraph before it is painted.
The master clock is using the redraw priority to create the source
that will be used to spin the paint sequence if something is being
animated using a timeline.
Unfortunately, the priority is too high and this causes starvation
when embedding into other toolkits -- like gtk+.
Thanks to Havoc Pennington for catching this.
Bug 1495 - Timelines run 4% short
Previously the timelines were timed by calculating the interval
between each frame stored as an integer number of milliseconds so some
precision is lost. For example, requesting 60 frames per second gets
converted to 16 ms per frame which is actually 62.5 frames per
second. This makes the timeline shorter by 4%.
This patch merges the common code for timing from the timeout pools
and frame sources into an internal clutter-timeout-interval file. This
stores the interval directly as the FPS and counts the number of
frames that have been reached instead of the elapsed time.
The hope is that this function makes it easier to extend the font
settings with more flags without having to add a function for every
setting.
A new flag for enabling hinting has been added. If set, this changes
the font options on the global PangoContext and any newly created
PangoContexts. The options are only set if the flag is changed from
the default so it won't override any detailed setting chosen by the
backend.
* clutter/clutter-main.c:
* clutter/clutter-main.h:
* clutter/clutter-private.h:
* clutter/x11/clutter-backend-x11.c:
(clutter_get_option_group_without_init):
Function to obtain clutter option group without opening display
(for use with foreign display and gtk_clutter_init). Bug 1033.
Stripped trailing whitespace.
* clutter/clutter-main.h: Make the priority constants public.
* clutter/clutter-stage.c: Use CLUTTER_PRIORITY_REDRAW.
* clutter/clutter-timeline.c: Use CLUTTER_PRIORITY_TIMELINE.
Bug #815 - Split up request, allocation, and paint box
* clutter/clutter-actor.[ch]: Rework the size allocation,
request and paint area. Now ::request_coords() is called
::allocate(), and ::query_coords() has been split into
::get_preferred_width() and ::get_preferred_height(). See
the documentation and the layout test on how to implement
a container and layout manager with the new API. (#915,
based on a patch by Havoc Pennington, Lucas Rocha and Johan
Bilien)
* clutter/clutter-clone-texture.c: Port CloneTexture to
the new size negotiation API; it just means forwarding
the requests to the parent texture.
* clutter/clutter-deprecated.h: Add deprecated and replaced
API.
* clutter/clutter-entry.c: Port Entry to the new size
negotiation API.
* clutter/clutter-group.c: Port Group to the new size
negotiation API; the semantics of the Group actor do not
change.
* clutter/clutter-label.c: Port Label to the new size
negotiation API, and vastly simplify the code.
* clutter/clutter-main.[ch]: Add API for executing a
relayout when needed.
* clutter/clutter-private.h: Add new Stage private API.
* clutter/clutter-rectangle.c: Update the get_abs_opacity()
call to get_paint_opacity().
* clutter/clutter-stage.c:
(clutter_stage_get_preferred_width),
(clutter_stage_get_preferred_height),
(clutter_stage_allocate),
(clutter_stage_class_init): Port Stage to the new size
negotiation API.
* clutter/clutter-texture.c: Port Texture to the new size
negotiation API.
* clutter/clutter-types.h: Add ClutterRequestMode enumeration.
* clutter/x11/clutter-stage-x11.c: Port the X11 stage
implementation to the new size negotiation API.
* tests/Makefile.am: Add the layout manager test case.
* tests/test-opacity.c: Update.
* tests/test-project.c: Update.
* tests/test-layout.c: Test case for a layout manager implemented
using the new size negotiation API; the layout manager handles
both transformed and untransformed children.
Bug #919 - Replacement pango renderer (Neil Roberts)
* clutter/clutter-backend.h:
* clutter/clutter-backend.c:
(clutter_backend_set_font_options),
(clutter_backend_get_font_options): Add the ability to set
the cairo_font_options_t* for the backend at construction
time, so that backend implementations can have their own
options.
* clutter/clutter-color.c: Include pango/pango-attributes.h
for the pango_color_parse() function.
* clutter/clutter-label.c:
(clutter_label_ensure_layout),
(clutter_label_init), (clutter_label_set_text),
(clutter_label_set_font_name), (clutter_label_set_ellipsize),
(clutter_label_set_use_markup): Ensure that the cache is
always primed when the Label changes; this makes sure that
the cache is rebuilt outside the paint run, which should
make the painting perform better especially on embedded
devices.
* clutter/clutter-entry.c:
(clutter_entry_ensure_layout),
(clutter_entry_init), (clutter_entry_set_text),
(clutter_entry_set_font_name): Ditto as above.
* clutter/clutter-private.h:
* clutter/clutter-main.[ch]: Create the font-map inside the
main context; add two new functions:
clutter_clear_glyph_cache()
clutter_set_use_mipmapped_text()
that control the glyphs cache.
* clutter/pango/Makefile.am:
* clutter/pango/pangoclutter-fontmap.c:
* clutter/pango/pangoclutter-private.h:
* clutter/pango/pangoclutter-render.c:
* clutter/pango/pangoclutter.h: Rewrite the Pango renderer
using a PangoCairo context and saving the glyphs inside a
more efficient cache.
* configure.ac: Depend on pangocairo instead of pangoft2.
* clutter/clutter-frame-source.h:
* clutter/clutter-frame-source.c:
New files that contain a replacement for g_timeout that try to
cope with system delays.
* clutter/Makefile.am: Added clutter-frame-source.{c,h}
* clutter/clutter-timeline.c (timeout_add): Use a frame source
instead of a g_timeout.
* clutter/clutter-main.c (clutter_threads_add_frame_source_full)
(clutter_threads_add_frame_source): New public functions to wrap a
frame source and grab the Clutter mutex.
* clutter/clutter-timeout-pool.c: Now calculates the timeout
expiration times in the same way as a frame source does so that it
counts time in frame intervals instead of setting the next
expiration time as an offset from the current time.
* Makefile.am: Use variables, instead of substitutions.
* clutter/clutter-private.h:
* clutter/clutter-main.h: Make clutter_do_event() public again,
as we need it in clutter-gtk.
* configure.ac:
* clutter/x11/Makefile.am:
* clutter/x11/clutter-x11.pc.in: Add a clutter-x11 pkg-config
file for clutter-gtk, as it depends on the X11 backend API, as
implemented by the GLX and EGLX backends.
* clutter/x11/clutter-event-x11.c (event_translate): Do not
propagate DestroyNotify events if the stage doesn't own the
window.
* tests/test-scale.c (main): Set values different from the default.
* clutter.symbols: Update
* clutter/clutter-actor.h: Rename the angle argument for
set_rotationx() to avoid gtk-doc complaining
* clutter/clutter-main.h:
* clutter/clutter-main.c:
(clutter_set_motion_events_enabled): Rename for consistency
(clutter_get_motion_events_frequency),
(clutter_set_motion_events_frequency): Add accessors for the default
motion events deliver frequency.
(clutter_do_event): Throttle down motion events delivery using the
motion events frequency setting, to avoid excessive redraws. (#608)
(clutter_context_get_default): Enable per-actor motion events, at
least for now.
* tests/test-events.c (red_button_cb):
* tests/test-grab.c (green_press_cb): Update.
clutter_ungrab_keyboard and clutter_get_keyboard_grab, in
clutter_do_event deliver keyboard related events only to the
actor with the keyboard grab if a grab exists.
* clutter/clutter-private.h: added keyboard_grab_actor to context.
* tests/test-grab.c: added testing for testing the keyboard grab.
clutter_ungrab_pointer and clutter_get_pointer_grab, in
clutter_do_event deliver pointer related events only to the
actor with the pointer grab if a grab exists.
* clutter/clutter-private.h: added pointer_grab_actor to context.
* tests/Makefile.am:
* tests/test-grab.c: added test for testing the pointer grab.
* clutter/clutter-timeline.[ch]: Added ClutterTimeline:duration,
a property for setting the duration of a timeline in milliseconds.
The property comes with accessors and a new constructor. The
frame rate used is the default value.
* clutter/clutter-private.h:
* clutter/clutter-main.[ch]: Add clutter_get_default_frame_rate()
and clutter_set_default_frame_rate(); these two functions control
the default frame rate to be used when creating timelines. Currently
is set to 60 frames-per-second.
* clutter/clutter-actor.c:
* clutter/clutter-actor.h:
* clutter/clutter-event.c:
* clutter/clutter-event.h:
* clutter/clutter-main.c:
* clutter/clutter-main.h:
* clutter/clutter-private.h:
* clutter/clutter-stage.c:
* clutter/clutter-stage.h:
* clutter/clutter-types.h:
Initial implementation of actors emmitting event signals (423);
- Actors set_reactive() to receive mouse events.
(call clutter_enable_motion_events() for per action motion events)
- clutter_stage_set_key_focus () to direct key events.
- Events bubble up to parents (ending at stage)
(original source identified by clutter_event_get_source())
TODO:
- enter/leave notifys for actors.
- stage specific events - fullscreen
- grabs
* tests/test-events.c:
Extend a little to use new API
* clutter/cogl/gl/cogl.c:
* clutter/glx/clutter-backend-glx.c:
Move get_proc_address into cogl and out of backend.
(shaders will need it)
* clutter/clutter-group.c: (clutter_group_real_lower):
Fix a minor compile warning.
* TODO:
Sync up.
The threads_enter() and threads_leave() functions are no-ops because Clutter
is not thread-aware nor thread-safe. Leaving them in is a source of confusion
so we just remove them.
Update the NEWS and the README files with the release notes.
Add a semi-private function, called clutter_base_init(), which initialises
the basic Clutter functionalities (at the moment, just the GLib type system)
without calling in the backend-specific code. This function is only useful
for gtk-doc, to introspect the library when generating documentation for
signals, properties and class hierarchy.
Also, change the documentation build system to use clutter_base_init() when
launching the scanner program.
* clutter/clutter-private.h: Remove inclusion of backend-specific
headers; update the main context object; add the declarations for
the event queue functions.
* clutter/clutter-backend.[ch]: Add the abstract ClutterBackend
object, which holds backend-specific settings, the main stage,
and the event queue. Every backend must implement a subclass of
ClutterBackend and ClutterStage.
* clutter/clutter-feature.c: Protect the GLX specific calls
behing #ifdef HAVE_CLUTTER_GLX.
* clutter/clutter-actor.c:
* clutter/clutter-group.c:
* clutter/clutter-clone-texture.c: Include GL/gl.h
* clutter/clutter-event.[ch]: Update public API and implement the
event queue private API; hold a reference on the event objects;
move out the keysym-to-unicode table; add the new event types.
* clutter/clutter-color.h: Include clutter-fixed.h
* clutter/clutter-main.c: Update API; get the main stage
from the backend object; process the event received from the
queue; lock/unlock the main mutex if we have one; move the
initialisation process sooner in the init sequence, in order to
have the backend object when we check for options; call the
backed vfuncs in the pre/post parse hooks.
* clutter/clutter-stage.c: Make ClutterStage and abstract class,
implemented by the backends.
* clutter/clutter/glx/clutter-glx.h:
* clutter/clutter/glx/clutter-backend-glx.[ch]:
* clutter/clutter/glx/clutter-event-glx.c:
* clutter/clutter/glx/clutter-stage-glx.[ch]:
* clutter/clutter/glx/Makefile.am: Add the GLX backend.
* clutter/clutter/egl/clutter-backend-egl.[ch]:
* clutter/clutter/egl/clutter-event-egl.c:
* clutter/clutter/egl/clutter-stage-egl.[ch]:
* clutter/clutter/egl/Makefile.am: Add the stub for a EGL backend.
* examples/*.c: Update for the new API.
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.