Commit Graph

127 Commits

Author SHA1 Message Date
Emmanuele Bassi
7ca28e0974 Add internal constructor function for each backend
We're going to use it to create an instance of each backend without
using the get_type() function.
2015-12-11 14:23:38 +00:00
Carlos Garnacho
9215852c32 x11: Implement ClutterEventExtender
This lifts the responsibility off its ClutterBackend.

https://bugzilla.gnome.org/show_bug.cgi?id=758238
2015-11-18 13:00:53 +01:00
Emmanuele Bassi
9d40fafa2a Do not generate backend-specific enumeration types
They should be part of the backend-specific API.

The only backend that has an enumeration type is the X11 one, and it's
small, so we can simply put it there.

This is not an ABI change: the backend-specific symbols are still in
the same SO. You'll be required to import clutter-x11.h to have access
to the GType method at the source level, whereas before just importing
clutter.h would have sufficed. The only user of that enumeration was a
function declared in clutter-x11.h, anyway.
2015-07-20 13:00:12 +01:00
Emmanuele Bassi
1912f28063 docs: Remove leftover DocBook tags
We use markdown for the documentation.
2015-03-12 20:22:57 +00:00
Owen W. Taylor
c32dc34080 Allow setting up quad-buffer stereo output
Add clutter_x11_set_use_stereo_stage() that can be called
before clutter_init() so that the CoglDisplay we create and all
stages created from that CoglDisplay will be created with a
stereo fbconfig.

This is done in clutter-x11 because of the similarity to the
existing clutter_x11_set_use_argb_visual(), and because it's
not clear without other examples whether the need to have
stereo enabled from before clutter_init() is universal or
somethign specific to GLX.

Cogl required version is increased to 1.20, which has the
required API.

https://bugzilla.gnome.org/show_bug.cgi?id=732706
2015-02-23 16:39:21 -05:00
Emmanuele Bassi
2034e75658 Use the proper debug category
Backend-related notes should use the `BACKEND` category, not `MISC`.
2015-01-01 12:44:19 +00:00
Adel Gadllah
cfcba18684 clutter-settings: Mark window-scaling-factor as fixed when set by the app
When an application sets the scaling factor manually we should mark it as fixed
and not override it when the xsettings change. This matches GDKs behaviour.

In order for this to work we cannot use the same path when setting the value
internally so introduce a _clutter_settings_set_property_internal and use it
for that.

https://bugzilla.gnome.org/show_bug.cgi?id=735244
2014-08-23 14:02:56 +02:00
Emmanuele Bassi
ddc1955f6b docs: Port backend-specific sections to markdown 2014-03-17 23:10:07 +00:00
Emmanuele Bassi
3209129d6b x11: Add keymap direction query
We should use the Xkb API to query the direction of the key map,
depending on the group. To get a valid result we need to go over
the Unicode equivalents of the key symbols for each group, so we
should cache the result.

The code used to query and cache the key map direction is taken
from GDK.

https://bugzilla.gnome.org/show_bug.cgi?id=705779
2014-03-03 23:42:33 +00:00
Emmanuele Bassi
dd034cccad x11: Fix bad logic in axis check
https://bugzilla.gnome.org/show_bug.cgi?id=711540
2014-02-10 17:43:16 +00:00
Emmanuele Bassi
75f81fee70 x11: Apply the window scaling factor
On high DPI density displays we create surfaces with a size scaled up by
a certain factor. Even if the contents stay at the same relative size
and position, we need to compensate the scaling both when changing the
surface size, and when dealing with input.

https://bugzilla.gnome.org/show_bug.cgi?id=705915
2013-09-19 22:51:52 +01:00
Jasper St. Pierre
e38ea7a20f x11: Remove support for XInput 1
Now we either use core X11 or XInput 2.

https://bugzilla.gnome.org/show_bug.cgi?id=703969
2013-07-11 14:03:43 -04:00
Jasper St. Pierre
0b32f99bd1 backend-x11: Remove bad branch prediction
This will only get once, at in Clutter initialization time.

https://bugzilla.gnome.org/show_bug.cgi?id=703969
2013-07-10 17:22:48 -04:00
Emmanuele Bassi
dc7d42d87a x11: Replace deprecated Cogl API 2013-07-03 18:24:27 +01:00
Emmanuele Bassi
03296e30e7 Fix compilers warnings when debugging is disabled 2013-04-04 11:53:38 +01:00
Jasper St. Pierre
c26d724f3d clutter-backend: Request XI2.3
Since XIQueryVersion, the bad API that it is, chooses the first client
version that it gets, we need to ensure that we pass XIQueryVersion the
new XI2.3 version, knowing fully well that Clutter won't be confused
by the new features.

https://bugzilla.gnome.org/show_bug.cgi?id=692466
2013-03-12 17:09:29 -04:00
Jasper St. Pierre
009da0c6ce x11: Always request XI2.2
The X server should fill in the minor version that it supports in the
case where it only supports the older version. We should not get a
BadRequest or fail the version check if we pass something higher.

https://bugzilla.gnome.org/show_bug.cgi?id=692466
2013-03-12 17:09:29 -04:00
Damien Lespiau
3e479a3326 cogl: Don't use cogl_xlib_set_diplay()
This function is deprecated and has been replaced by set_display() on
the renderer. This is done in the get_renderer() vfunc of both the x11
and gdk backends already.

Actually cogl_xlib_set_diplay() is now a no-op and can be safely removed.

https://bugzilla.gnome.org/show_bug.cgi?id=687652
2013-02-20 23:06:28 +00:00
Emmanuele Bassi
47c1e26385 Enable XInput support by default
Instead of using core events, we should move into the XXI century, and
use the XInput extension.

https://bugzilla.gnome.org/show_bug.cgi?id=673838
2012-12-18 01:27:31 +00:00
Emmanuele Bassi
26d8ad7479 Be resilient in case there is no device manager
It's possible to run Clutter with the 'null' input backend, which means
that clutter_device_manager_get_default() may return NULL. In the future
we may add a default dummy device manager, but right now it's safer to
just add a simple NULL check in the places where we ask for the device
manager.
2012-04-26 13:56:00 +01:00
Emmanuele Bassi
09a317d23d x11: Add support for touch events
For the time being, we just relay everything we get from the X server to
the Clutter application.
2012-03-19 14:29:24 +00:00
Emmanuele Bassi
676a317439 x11: Add support for scroll valuators on XInput2.2 2012-03-19 12:41:24 +00:00
Emmanuele Bassi
f54a4532a4 x11/backend: Ensure that pre/post parse hooks are not exposed
Not even as private methods.
2012-03-07 12:36:43 +00:00
Neil Roberts
1f7968e5f9 wayland/x11: Set constraints on the CoglRenderer
When using the Wayland backend this sets a constraint that the
CoglRenderer selects the Wayland EGL winsys.

When a Wayland compositor display is set it now also sets a constraint
that the render should use EGL because only EGL renderers will set up
the required wl_drm global object.

The X11 backend now sets the X11 constraint.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-01 11:41:51 +00:00
Emmanuele Bassi
17c89bd0a0 backend: Clean up the device manager creation
Create the device manager during the event initialization, where it
makes sense.

This allows us to get rid of the per-backend get_device_manager()
virtual function, and just store the DeviceManager pointer into the
ClutterBackend structure.
2011-11-10 14:55:03 +00:00
Emmanuele Bassi
b980d2dc17 */backend: Store the StageWindow implementation type 2011-11-10 14:55:03 +00:00
Emmanuele Bassi
5c9cafb411 cogl/backend: Remove the ClutterBackendCogl class
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.
2011-11-10 14:55:03 +00:00
Emmanuele Bassi
db211a2131 Remove per-backend CLUTTER_VBLANK envvar
We have a global flag we can use.
2011-11-10 14:55:02 +00:00
Emmanuele Bassi
68e8ef0103 x11/backend: Use the context creation hooks
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.
2011-11-10 14:42:40 +00:00
Emmanuele Bassi
adb6ffbd0e backend: Unify the event initialization
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.
2011-11-10 14:42:40 +00:00
Emmanuele Bassi
983510fad4 x11/backend: Use an internal GError
Don't just return the error from Cogl, but proxy it so that it has the
correct error domain and code.
2011-11-03 14:02:43 +00:00
Emmanuele Bassi
a73f1e6768 Cosmetic fixes 2011-11-03 13:45:19 +00:00
Emmanuele Bassi
a09bbffd92 Implement multi-backend support
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.
2011-11-03 13:45:19 +00:00
Giovanni Campagna
9c102b7c51 Rework the interaction between the Cogl and GDK / X11 backends.
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
2011-11-03 13:45:17 +00:00
Robert Bragg
6e28121ff3 cogl: include <cogl/cogl-xlib.h> for xlib specific 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>
2011-11-01 16:24:00 +00:00
Emmanuele Bassi
2b81d90dd7 Eliminate G_CONST_RETURN
The G_CONST_RETURN define in GLib is, and has always been, a bit fuzzy.

We always used it to conform to the platform, at least for public-facing
API.

At first I assumed it has something to do with brain-damaged compilers
or with weird platforms where const was not really supported; sadly,
it's something much, much worse: it's a define that can be toggled at
compile-time to remove const from the signature of public API. This is a
truly terrifying feature that I assume was added in the past century,
and whose inception clearly had something to do with massive doses of
absynthe and opium — because any other explanation would make the
existence of such a feature even worse than assuming drugs had anything
to do with it.

Anyway, and pleasing the gods, this dubious feature is being
removed/deprecated in GLib; see bug:

  https://bugzilla.gnome.org/show_bug.cgi?id=644611

Before deprecation, though, we should just remove its usage from the
whole API. We should especially remove its usage from Cally's internals,
since there it never made sense in the first place.
2011-06-07 16:06:24 +01:00
Neil Roberts
d5022054eb cogl-renderer: Move the XEvent filters to be generic for all renderers
Instead of having cogl_renderer_xlib_add_filter and friends there is
now cogl_renderer_add_native_filter which can be used regardless of
the backend. The callback function for the filter now just takes a
void pointer instead of an XEvent pointer which should be interpreted
differently depending on the backend. For example, on Xlib it would
still be an XEvent but on Windows it could be a MSG. This simplifies
the code somewhat because the _cogl_xlib_add_filter no longer needs to
have its own filter list when a stub renderer is used because there is
always a renderer available.

cogl_renderer_xlib_handle_event has also been renamed to
cogl_renderer_handle_native_event. This just forwards the event on to
all of the listeners. The backend renderer is expected to register its
own event filter if it wants to process the events in some way.
2011-04-20 18:17:06 +01:00
Robert Bragg
70767f08dc Adds a --with-system-cogl config option for Clutter
This makes it possible to build Clutter against a standalone build of
Cogl instead of having the Clutter build traverse into the clutter/cogl
subdirectory.
2011-04-11 17:54:36 +01:00
Robert Bragg
d6f110a4d2 Moves all GLX code down from Clutter to Cogl
This migrates all the GLX window system code down from the Clutter
backend code into a Cogl winsys. Moving OpenGL window system binding
code down from Clutter into Cogl is the biggest blocker to having Cogl
become a standalone 3D graphics library, so this is an important step in
that direction.
2011-04-11 17:54:36 +01:00
Emmanuele Bassi
4f3a4ab01b x11: Use g_set_error_literal()
The g_set_error() function takes a format string.
2011-03-04 23:53:45 +00:00
Emmanuele Bassi
3e5aa9ed63 Add private header for event-related API 2011-02-18 16:35:36 +00:00
Emmanuele Bassi
56d133f908 backend: Move event translators to the base class
In the future, we want event translators to be the way to handle events
in backends. For this reason, they should be a part of the base abstract
ClutterBackend class, and not an X11-only concept.
2011-02-09 13:29:30 +00:00
Emmanuele Bassi
bbf73f58b6 Skip some x11-specific calls when generating introspection
Some types are just not handled currently.
2011-02-08 15:31:20 +00:00
Emmanuele Bassi
4f53653bf9 x11: Remove more private symbols
Some private functions escaped my wrath in commit
a277b4091a.

Thanks to: Emilio Pozuelo Monfort on #clutter
2011-01-25 11:00:20 +00:00
Emmanuele Bassi
a277b4091a x11: Hide all private symbols
The x11 backend exposes a lot of symbols that are meant to only be used
when implementing a subclassed backend, like the glx and eglx ones.

The uninstalled headers are also filled with cruft declarations of
functions long since removed.

Let's try to clean up this mess.
2011-01-21 10:25:46 +00:00
Emmanuele Bassi
fa3c5a28a7 backend/x11: Allow querying xinput support
Undeprecate the XInput-related X11 API: since we don't enable XI support
by default we still need to ask for it, and see if we have it after the
backend initialization sequence.
2011-01-21 10:25:44 +00:00
Emmanuele Bassi
7c25b063aa x11: Use XI2 API only if we support it
XIQueryVersion() is XI2 API.
2011-01-21 10:25:43 +00:00
Emmanuele Bassi
1b1e77b469 event/x11: Rework the way we translate X11 events
This is a lump commit that is fairly difficult to break down without
either breaking bisecting or breaking the test cases.

The new design for handling X11 event translation works this way:

  - ClutterBackend::translate_event() has been added as the central
    point used by a ClutterBackend implementation to translate a
    native event into a ClutterEvent;

  - ClutterEventTranslator is a private interface that should be
    implemented by backend-specific objects, like stage
    implementations and ClutterDeviceManager sub-classes, and
    allows dealing with class-specific event translation;

  - ClutterStageX11 implements EventTranslator, and deals with the
    stage-relative X11 events coming from the X11 event source;

  - ClutterStageGLX overrides EventTranslator, in order to
    deal with the INTEL_GLX_swap_event extension, and it chains up
    to the X11 default implementation;

  - ClutterDeviceManagerX11 has been split into two separate classes,
    one that deals with core and (optionally) XI1 events, and the
    other that deals with XI2 events; the selection is done at run-time,
    since the core+XI1 and XI2 mechanisms are mutually exclusive.

All the other backends we officially support still use their own
custom event source and translation function, but the end goal is to
migrate them to the translate_event() virtual function, and have the
event source be a shared part of Clutter core.
2011-01-21 10:25:43 +00:00
Emmanuele Bassi
d229036441 Reduce the amount of g-ir-scanner warnings
As much as we can; the remaining warnings are mostly valid things that
the introspection scanner still flags as potential issues.
2010-12-09 12:36:50 +00:00
Emmanuele Bassi
446107f19d x11: Check for initialized context when enabling ARGB visuals
Instead of using the backend singleton. This allows lazy initialization
of Clutter.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2435
2010-11-24 12:02:38 +00:00