GLib has a "diagnostic mode" switch that can be checked to enable debug
messages on deprecated properties and signals, as these are purely
run-time constructs, and as such cannot be caught by compiler warnings.
The diagnostic mode is toggled by a simple environment variable, and
can be used to ease porting of application code.
We can use something similar to mark deprecated virtual functions and
other run-time constructs; to avoid collisions, we should use our own
environment variable, CLUTTER_ENABLE_DIAGNOSTIC.
There was an #ifdef'd section of code for profiling that was using the
wrong variable name so it would not build.
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
Since we have a _clutter_debug_message() function compiled in
unconditionally we have no further need for the equivalent conditional
version defined in clutter-profile.[ch]: we can simply do the work in
one function.
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.
Make it consistent across the various build options (with or without
profiling enabled), and add a timestamp using the monotonic clock to
every debug message.
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.
Instead of defining new symbols for the windowing systems enabled at
configure time, we can reuse the same symbols for both the compile time
and run time checks, e.g.:
#ifdef CLUTTER_WINDOWING_X11
if (clutter_check_windowing_backend (CLUTTER_WINDOWING_X11))
/* use the clutter_x11_* API */
else
#endif
#ifdef CLUTTER_WINDOWING_WIN32
if (clutter_check_windowing_backend (CLUTTER_WINDOWING_WIN32))
/* use the clutter_win32_* API */
#endif
This scheme allows us to ensure that the input system namespace is free
for us to use and select at run time in later versions of Clutter.
Portable code should be allowed to check type backend currently being
used, so that it can use platform-specific API (not just Clutter's).
We don't want to go down the GDK route, with public types for
ClutterBackend and ClutterStageWindow implementations, and use the type
system, e.g.:
#ifdef GDK_WINDOWING_X11
if (GDK_IS_WINDOW_X11 (window))
use_x11_api (window);
else
#endif
#ifdef GDK_WINDOWING_WIN32
if (GDK_IS_WINDOW_WIN32 (window))
use_win32_api (window);
else
#endif
g_critical ("Unsupported backend");
This system would make us expose the backend system, and we want to
still reserve us the option to change the backend system to increase its
granularity — e.g. choosing different input event systems regardless of
the windowing system.
This commit adds a simple function that checks the backend type against
a symbolic constant — the same constant string that can be used to
select the backend at run-time through the CLUTTER_BACKEND environment
variable.
The Clutter backend split is opaque enough that should allow us to just
build all possible backends inside the same shared object, and select
the wanted backend at initialization time.
This requires some work in the build system, as well as the
initialization code, to remove duplicate functions that might cause
conflicts at build and link time. We also need to defer all the checks
of the internal state of the platform-specific API to run-time type
checks.
Since the Windows GUI system is assuming multithreadedness, initializing
locks after entering the GUI portion on Windows is likely to cause
problems[1][2], which results many Clutter programs to crash due to
releasing resources that they did not own.
[1]: Multi-threaded use of GTK+ on Win32 in README.win32 of GTK+
source package
[2]: Explanation of Windows GUI system regarding its multithreadness
assumptions-
http://mail.gnome.org/archives/gtk-list/2011-June/msg00005.html
Or, better, the fact that the behaviour of any Clutter function will be
undefined in case the initialization fails.
The value returned by clutter_init() and friends has to be handled
properly.
The CLUTTER_DEBUG class of debugging flags is meant for debugging notes,
while the CLUTTER_PAINT debugging flags are for changing the output of
the paint cycle. Painting the DeformEffect tiles should go in the latter.
On top of the existing "Settings" group in the settings.ini file we
should have two more groups:
Environment - contains all the configuration possible through
environment variables
Debug - contains all the possible debug variables
ClutterSettings should be able to load its initial state by using
configuration files in SYSCONFDIR and XDG_CONFIG_HOME. This allows
Clutter to have a system (and user) configuration on platforms that
do not have XSETTINGS bridges.
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.
The Big Clutter Lock™ can now be a static GMutex, since GLib supports
them. We can also drop a bunch of checks given the recent changes in
GLib threading API.
When testing the performance of an application, it's often useful to
force it to continuously redraw instead of going idle to help measure
the frame rate. This just adds a CLUTTER_PAINT=continuous-redraw which
causes the master clock to queue a redraw on all of the stages
just before it prepares its source.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
Out-of-band transforms are considered to be all actor transforms done
directly with the Cogl API instead of via ClutterActor::apply_transform.
By running with CLUTTER_DEBUG=oob-transform then Clutter will explicitly
try to detect when un-expected transforms have been applied to the
modelview matrix stack.
Out-of-band transforms can lead to awkward bugs in Clutter applications
because Clutter itself doesn't know about them and this can disrupt
Clutter's input handling and calculations of actor paint-volumes
which can lead to visual artifacts.
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
The repaint functions list can (and should) be manipulated from
different threads, but it currently doesn't prevent multiple threads
from accessing it concurrently. We should have a simple lock and take it
when adding and removing elements from the list; the invocation is still
performed under the Big Clutter Lock™, so it doesn't require special
handling.
It is possible, by calling clutter_set_motion_events_enabled() prior to
the creation of any stage, to control the per-actor motion event
delivery flag on each newly created stage. Since we deprecated the
global accessor functions in favour of the per-Stage ones, we need to
remove the call to clutter_get_motion_events_enabled() inside the
ClutterStage instance initialization, and replace it with an internal
function.
This code will go away when we can finally break API and remove the
deprecated functions.
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.
When using CLUTTER_PAINT=paint-volumes to visualize the paint-volumes of
actors we were already disabling clipped-redraws because we are drawing
extra geometry that the actors don't know about but we didn't disable
culling. This was resulting in actors disappearing while using this
debug option.
This adds CLUTTER_PAINT=disable-offscreen-redirect to help diagnose
problems with the correct opacity changes. This just makes it so that
it never installs the flatten effect so it will never automatically
redirect an actor offscreen.
In Cogl, cogl-pango.h has moved to <cogl-pango/cogl-pango.h>. When
using the experimental 2.0 API (which Clutter does) it is no longer
possible to include it under the old name of <cogl/cogl-pango.h> so we
need to update the include location.