All StageWindow implementation already have back pointers, but we need a
unified API to actually set them from the generic code path; we can use
properties on the StageWindow interface — though this requires fixing
all backends at the same time, to avoid GObject complaining.
All the functionality that ClutterBackendCogl provided has been moved
into ClutterBackend itself, so there is no need to have this class
around in the source.
Cogl-based backends can derive directly from ClutterBackend.
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>
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>
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.
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.
The ClutterGeometry type is a poor substitute of cairo_rectangle_int_t,
with unsigned integers for width and height to complicate matters.
Let's remove the internal usage of ClutterGeometry and switch to the
rectangle type from Cairo.
https://bugzilla.gnome.org/show_bug.cgi?id=656663
All 2D coordinate spaces in Cogl have their origin at the top-left so we
shouldn't be flipping the coordinates we pass to
cogl_framebuffer_swap_region to be relative to the bottom of the
framebuffer.
This bumps the Cogl version requirement to 1.7.5 since we've had to fix
a bug in the semantics of cogl_framebuffer_swap_region.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
This avoids explicitly including gl or egl headers in
clutter-egl-headers.h. We were getting build failures when building
clutter against a libcogl that has runtime support for GL and GLES
because cogl-defines.h was including gl.h and then clutter-egl-headers.h
was later including GLES2/gl.h with typedef conflicts. Clutter relies on
Cogl to abstract GL and GLES and the winsys APIs like EGL and GLX so
Clutter should just rely on cogl.h to include the appropriate egl.h in
clutter-egl-headers.h.
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
This adds a public function to get the bounds of the current clipped
redraw on a stage. This should only be called while the stage is being
painted. The function diverts to a virtual function on the
ClutterStageWindow implementation. If the function isn't implemented
or it returns FALSE then the entire stage is reported. The clip bounds
are in integer pixel coordinates in the stage's coordinate space.
http://bugzilla.clutter-project.org/show_bug.cgi?id=2421
Cogl recently renamed symbols with the form
cogl_onscreen_<platform>_blah to be consistent with other platform
specific APIs so they are now named like cogl_<platform>_onscreen_blah.
This makes the corresponding change to clutter.
Cogl changed has changed the name of cogl_context_egl_get_egl_context to
cogl_egl_context_get_egl_context to be consistent with other platform
specific symbols.
Since the implementation of ClutterGLXTexturePixmap has nothing GLX
specific about it (it is simply layered on top of
ClutterX11TexturePixmap) we don't need to include glx.h. Removing this
include also means that the code can be built for compatibility against
GLES drivers.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
cogl_renderer_xlib_set_foreign_display was renamed to
cogl_xlib_renderer_set_foriegn_display so this is the corresponding
change to clutter.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Some parts of the StageWindow interface aren't meaningful for all window
systems. This makes stage_window_set_title/fullscreen/cursor_visible
optional instead of requiring those window systems to implement empty
stubs. Notably the empty stubs we had in the Cogl backend (previously
the EGL backend) used g_warning to report the feature as unsupported and
that was causing conformance test failures.
Since GLX and EGL are abstracted by Cogl the two backends are both
implementing everything using the Cogl API and they are almost
identical.
This updates the egl backend to support everything that the glx backend
supports. Now that EGL and GLX are abstracted by Cogl, the plan is that
we will squash the clutter-egl/glx backends into one. Since the EGL
backend in clutter can conditionally not depend on X11 we will use the
EGL backend as the starting point of our common backend.
https://bugzilla.gnome.org/show_bug.cgi?id=649826
Cogl has now been split out into a standalone project with a separate
repository at git://git.gnome.org/cogl. From now on the Clutter build
will now simply look for a cogl-1.0 pkg-config file to find a suitable
Cogl library to link against at build time.
When comparing the wrap modes of two pipeline layers it now considers
COGL_WRAP_MODE_AUTOMATIC to be equivalent to CLAMP_TO_EDGE. By the
time the pipeline is in the journal, the upper primitive code is
expected to have overridden this wrap mode with something else if it
wants any other behaviour. This is important for getting text to batch
together with textures because the text explicitly sets the wrap mode
to CLAMP_TO_EDGE on its pipeline.
The material cache will now only set the special combine mode if the
texture only has an alpha component. The atlased textures will have
all four components so it will leave the combine functions at the
default. This increases the chances of batching between glyphs and
images.
When using the global atlas, the glyph from cairo is now rendered into
an ARGB surface rather than an alpha-only surface.
Instead of creating just two materials (one for texturing and one for
solid primitives) the pango renderer now maintains a cache of
pipelines. The display list can request a pipeline for a texture from
the cache. The same pipeline cache is used by all display lists so
that the pipelines can be shared. This avoids changing the texture on
the material during a paint run.
It now avoids trying to reserve space for zero-sized glyphs. That
happens for example when the layout contains a space. This was causing
the regular glyph cache to be used because the global atlas does not
support zero-sized images. That would then break up the
batching. Instead it now still reserves an entry in the cache but
leaves the texture as COGL_INVALID_HANDLE.
When rendering a glyph from a texture, instead of adding the glyph's
texture handle to the display list it now retrieves the base texture
using _cogl_texture_foreach_subtexture_in_region and adds that
instead. That way the display can recognise that glyphs in the global
atlas are sharing the same texture and combine them into one VBO.
Whenever the glyph cache puts a glyph in the global atlas it will now
register for notifications of reorganisation of the global
atlases. When this happens it will forward this on as a notification
of reorganisation of the glyph cache.
This adds cogl_atlas_texture_* functions to register a callback that
will get invoked whenever any of the CoglAtlas's the textures use get
reorganized. The callback is global and is not tied to any particular
atlas texture.
If mipmapping is disabled, it will now try to create a standalone
atlas texture for a glyph rather than putting it in the atlas.
If the atlas texture can't be created then it will fallback to the
glyph cache.
This adds a new function called _cogl_atlas_texture_new_with_size. The
old new_from_bitmap function now just calls this and updates the
texture with the data.