Don't replace create_context(): given that the X11 backend already uses
Cogl for the context creation, we can just provide the right data
structures ourselves.
Since we use Cogl for the context creation we can now provide a default
context creation that should just work, plus a couple of hooks to allow
plugging into the creation sequence for platforms supported by Cogl that
require special handling — like foreign displays or alpha-enabled swap
chains.
The various backends have now two choices: either replace the
create_context() in its entirety, or plug themselves into the default
context creation.
Input backends are, in some cases, independent from the windowing system
backends; we can initialize input handling using a model similar to what
we use for windowing backends, including an environment variable and
compile-/run-time checks.
This model allows us to remove the backend-specific init_events(), and
use a generic implementation directly inside the base ClutterBackend
class, thus further reducing the backend-specific code that every
platform has to implement.
This requires some minor surgery to every single backend, to make sure
that the function exposed to initialize the event loop is similar and
performs roughly the same operations.
Right now, we pass through to Pango unrecognized hexadecimal formats
when parsing colors from strings. Since we parse all possible formats
ourselves, we can do validation ourselves as well, and avoid the Pango
path.
Previously, if there was whitespace between "l" and the comma before the
alpha value, parsing would fail. This patch allows that whitespace
making it consistent with whitespace being allowed everywhere else.
https://bugzilla.gnome.org/show_bug.cgi?id=663594
These methods are short-hands for accessing the position and size,
which are already shorthands for accessing the various dimensional
and positional attributes. Plus, they use ClutterGeometry, which is a
fairly bad data type for a rectangle.
We still use ClutterGeometry internally in a couple of places, but we
should really move away from that flawed rectangle data type, and use
the Cairo one.
Sadly, we still have some public API that we cannot remove yet.
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.
A GDK backend for clutter was added in commits 610a9c17
(Add A new GDK backend) and f14cbf5b (gdk: Allow disabling event retrieval)
These are not included in the Win32 builds for the moment as GDK3 is
quite unstable on Windows at this time
-Update clutter-version.h.win32.in to reflect the state of
clutter-version.h.in commit 21a24c86 (updated in commit 8249e488)
-Also add clutter_check_windowing_backend to clutter.symbols as a result.
The clutter-stage.h header still has a bunch of macros that have, for
reasons unknown[*], survived the 1.0 API cut and have long since been
deprecated. Let's hide them under the deprecated/ carpet and let us
never speak of them ever again.
[*] pretty sure alcohol or other psychotropic substances were involved
but I take the 5th on that.
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.
We need debugging notes, to see what's happening when handling events.
We need to queue a (clipped) redraw when receiving a GDK_EXPOSE event.
We need to check the device (both master and source) of the event using
the GdkEvent API, and pass them to the ClutterEvent using the
corresponding Clutter API.
The code is generally wrong, and does not work. We need to skip the
GdkWindow creation when we have a foreing window, but we still need to
create the Cogl onscreen buffer and connect it to the GdkWindow's native
resource.
Just like the other backends can disable the internal event handling,
and use clutter_<backend>_handle_event() to do the native → Clutter
event translation.
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.
Previously, the Cogl backend was at times a subclass of the X11
backend, and at times a standalone one. Now it is the other way
round, with GDK and X11 backends providing the concrete classes,
layered on top of the generic Cogl backend. A new EglNative backend
was introduced for direct to framebuffer rendering. This greatly
simplifies the API design (at the expense of some casts needed)
and reduces the amount of #ifdefs, without duplicating code.
https://bugzilla.gnome.org/show_bug.cgi?id=657434
This commit introduces a new flavour for Clutter, that uses GDK
for handling all window system specific interactions (except for
creating the cogl context, as cogl does not know about GDK), including
in particular events. This is not compatible with the X11 (glx)
flavour, and this is reflected by the different soname (libclutter-gdk-1.0.so),
as all X11 specific functions and classes are not available. If you
wish to be compatible, you should check for CLUTTER_WINDOWING_X11.
Other than that, this backend should be on feature parity with X11,
including XInput 2, XSettings and EMWH (with much, much less code)
https://bugzilla.gnome.org/show_bug.cgi?id=657434
If our check of the CoglOnscreenTemplate during initialization fails
then we disable the request for an alpha component in the swap chain and
try the check again.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
Avoid double argument checking, and a deprecation warning when
implementing create() as a wrapper around create_region(), by using
a simple internal function.
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.
Since Xlib.h is such a terrible citizen when it comes to symbol
namespacing it's not desirable to include Xlib.h if it is not absolutely
required. Cogl now has a standalone cogl-xlib.h that should be included
whenever any xlib specific symbols are required.
This patch updates clutter to include <cogl/cogl-xlib.h> wherever
clutter needs to use xlib specific cogl apis.
Acked-by: Emmanuele Bassi <ebassi@linux.intel.com>
We use an atexit() handler to print out the profile report coming from
Uprof. The g_atexit() call has been deprecated by GLib, but since this
use case is pretty specific and it's not meant to be turned on by
default (or distributed) then we can safely disable the deprecation
warnings inside clutter-profile.c.
The g_atexit() function has been deprecated in GLib as it is a fairly
bad idea in basically all cases.
We could probably use a GCC destructor if we didn't care about
portability, but for the time being we just remove the atexit() handler
that disposed the backend.
There are a couple of gotchas in the 'mapped' flag that are not properly
documented, or are documented only in the actor_invariants.txt file; we
should have a proper description in the API reference as well, to avoid
confusion.
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
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
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
assumtopns-http://lists-archives.org/gtk/12724-compiling-a-gtk-application-on-windows.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.
This removes the create_texture implementation for ClutterBlurEffect
because we already account for padding in the get_paint_volume
implementation so we were creating textures larger than necessary.
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
Just like ClutterBindConstraint has two shorthand enumerations for binding
position and size and avoid using multiple instances, ClutterAlignConstraint
should have a way to align an actor with the same alignment factor on both
axis at the same time; this is especially useful for centering actors.
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.
This function is called when the backend is being disposed - as a way
of releasing all ClutterShader. This doesn't take into account three
things:
- ClutterShader is deprecated
- the Backend is *never* disposed
- once the process terminates, all its resources are automatically
released by the OS
So the _clutter_shader_release_all() function is a pointless exercise
in futility.
For deprecation of APIs, in commits
522b8be3 (clutter_get_input_device_for_id())
6ef09dd1 (clutter_clear_glyph_cache())
01080dc5 (clutter_[sg]et_font_flags())
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.
This moves a couple of definitions to the common types header, and makes
sure that ClutterBehaviour subclasses include clutter-behaviour.h first,
so that their types can be fully expanded without necessarily have the
ClutterBehaviour header header included by their public headers. This is
the necessary prelude to have clutter-behaviour.[ch] moved to the
deprecated section.
The code that has been deprecated should live into its own directory,
both in the repository and when installed. This should make it clear
which functionality is actually maintained and which is not.
We start with an oldie: the frame source API.
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.
The static initializer for GMutex has been removed from GLib.
The g_thread_supported() call can also be removed: threading is always
enabled in GLib ≥ 2.31.
This commit introduces a unicode-to-keyval conversion function that
performs identical action as the gdk version of that function. Also
added is the necessary table holding all the conversion values.
https://bugzilla.gnome.org/show_bug.cgi?id=661015
If we do project() → get_bounding_box(), we'll try to complete the
volume twice, which whacks out all the lazily computed vertices.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
This is used as an alternative to calling
clutter_shader_effect_set_shader_source. A ClutterShaderEffect
subclass is now expected to implement this method to return the source
for the effect that will be used for all instances of this
subclass. It is only called once regardless of the number of instances
created. That way Clutter can avoid recompiling the shader source for
every new instance of the effect.
https://bugzilla.gnome.org/show_bug.cgi?id=660512
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>