Commit Graph

329 Commits

Author SHA1 Message Date
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
1c500f7de9 x11: Reset scroll valuators
We need to clear up the state on enter and leave, as well as when the X
server tells us that the device has changed.
2012-03-19 14:29:23 +00:00
Emmanuele Bassi
676a317439 x11: Add support for scroll valuators on XInput2.2 2012-03-19 12:41:24 +00:00
Lionel Landwerlin
4d42904fcc x11/stage: fix multi-stage support
When handling Configure events from the X server we update the
internal copy of the window size. Unfortunately we may be updating the
wrong stage implementation because we use the one related to the event
translator (which is the first created stage).

This patch fix flickering/redrawning issues with multi-stage by
looking for the right stage implementation associated with an XEvent.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@linux.intel.com>
2012-03-18 00:17:36 +00:00
Emmanuele Bassi
3a86d88b43 x11/device-manager-core: Avoid a signed/unsigned comparison 2012-03-07 12:36:43 +00:00
Emmanuele Bassi
f5065059b7 x11/keymap: Avoid a signed/unsigned comparison 2012-03-07 12:36:43 +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
Neil Roberts
a0d3b01aa9 device-manager-core-x11: Create core input devices as x11
The core input devices when XInput doesn't work were being created as
generic ClutterInputDevices instead of ClutterInputDeviceX11s. This
meant the keycode_to_evdev virtual wouldn't work.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-01 11:41:51 +00:00
Neil Roberts
13e3f9e5f1 Add an input device function to convert keycodes to evdev codes
This adds a virtual function to ClutterInputDevice to translate a
keycode from the hardware_keycode member of ClutterKeyEvent to an
evdev keycode. The function can fail so that input backends that don't
have a sensible way to translate to evdev keycodes can return FALSE.
There are implementations for evdev, wayland and X. The X
implementation assumes that the X server is using an evdev driver in
which case the hardware keycodes are the evdev codes plus 8.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-01 11:41:51 +00:00
Robert Bragg
a8e631543e Reduce our internal dependence on the Cogl 1.x api
Since Cogl has started restricting what cogl 1.x api is exposed when
COGL_ENABLE_EXPERIMENTAL_2_0_API is defined and since we build all
Clutter internals with COGL_ENABLE_EXPERIMENTAL_2_0_API defined this
patch makes a first pass at reducing our internal use of the Cogl 1.x
api.

The most notable api that's no longer exposed to us internally is
the cogl_material_ api so this switches all Clutter internals to use the
cogl_pipeline_ api instead. This patch also makes quite a bit of
progress removing internal uses of CoglHandle although there is still
more to go.
2012-02-21 17:46:11 +00:00
Robert Bragg
eff95eba4a Pass context to cogl_texture_pixmap_x11_new() api
The experimental cogl_texture_pixmap_x11_new() api was recently changed
to take an explicit context argument and return a GError on failures.
This updates Clutter's use of the api accordingly.
2012-02-21 17:46:11 +00:00
Emmanuele Bassi
b8e5603a85 x11/stage: Allow setting fullscreen hint before realize
It should be possible to do:

  clutter_stage_set_fullscreen (stage, TRUE);
  clutter_actor_show (stage);

and have the stage be full screen as soon as it is shown.

Currently, we need to call clutter_actor_realize() prior to calling
set_fullscreen(), otherwise the backing X window will not be set,
and ClutterStageX11 will silently discard the change.

If set_fullscreen() was called prior to realization, ClutterStageX11
should delay setting the fullscreen hint until the realize() chain
has been successfully executed.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2515
2012-02-15 14:20:59 +00:00
Lionel Landwerlin
d31bd6fe92 x11: adjust size to minimal size when realizing
If you execute the following sequence :

stage = clutter_stage_new ();
clutter_actor_set_size (stage, 1280, 800);
clutter_actor_realize (stage);

Then you end up creating an onscreen buffer of size 1280x800 but
ClutterStageX11 storing the stage size at 640x480.

This patch resync the 2 implementation by using the ClutterStage's
size in both classes when realizing.

Signed-off-by: Lionel Landwerlin <llandwerlin@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=667540
2012-02-15 11:32:41 +00:00
Emmanuele Bassi
2ed9e0d557 x11: Remove CLUTTER_DISABLE_DEPRECATED usage
Switch to CLUTTER_DEPRECATED and CLUTTER_DEPRECATED_FOR.
2012-01-31 10:34:45 +00:00
Emmanuele Bassi
bacd4dd6a0 Remove unused variable 2012-01-26 18:11:49 +00:00
Emmanuele Bassi
3780e3e4f0 x11: Unbreak the build
The stage wrapper is on the ClutterStageCogl instance.
2012-01-26 10:29:50 +00:00
Emmanuele Bassi
fdf89a9e06 Merge branch 'stage-state'
* stage-state:
  docs: Update ClutterStageState flags
  wayland: Use the Stage state tracking
  gdk: Use the Stage state tracking
  win32: Use the Stage state tracking
  x11: Use the Stage state tracking
  osx: Use the Stage state tracking
  stage: Add state tracking
2012-01-26 08:42:00 +00:00
Emmanuele Bassi
12e4f300a7 x11: Use the Stage state tracking 2012-01-26 08:31:10 +00:00
Emmanuele Bassi
71323b8bfc x11/stage: Use symbolic constants for source function
And make sure to use the clutter_threads_add_timeout(), so that the
function is called under the Clutter lock.
2012-01-25 23:20:24 +00:00
Emmanuele Bassi
30c464e68f x11/texture-pixmap: Use ClutterActor.queue_redraw_with_clip()
Instead of using a PaintVolume for a 2D region, and an internal
function, use the newly added queue_redraw_with_clip() method.

This removes the last bit of internal API usage in the
ClutterX11TexturePixmap actor.

https://bugzilla.gnome.org/show_bug.cgi?id=660997
2011-12-12 17:29:58 +00:00
Emmanuele Bassi
749fe38fec x11/stage: Use ClutterActor.queue_redraw_with_clip()
Instead of using a paint volume for a 2D region, use the newly added
queue_redraw_with_clip() method.

https://bugzilla.gnome.org/show_bug.cgi?id=660997
2011-12-12 17:29:58 +00:00
Emmanuele Bassi
1dc7c45438 x11: Do not try to access private structures
ClutterInputDeviceX11 has been made private, so we cannot access it from
outside of clutter-input-device-core-x11.c. We should have simple
accessors for the min/max keycode, which is the only detail that we use.
2011-12-01 13:44:21 +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
Jasper St. Pierre
b96773f9c9 clutter-stage-x11: Make sure to set geometry x and y
Otherwise, we could be dealing with uninitialized values, causing
havoc all over the place.

https://bugzilla.gnome.org/show_bug.cgi?id=663733
2011-11-10 12:57:34 +00:00
Emmanuele Bassi
101f39ea92 Replace usage of [sg]et_geometry()
The set_geometry() and get_geometry() methods are going to be
deprecated.
2011-11-08 14:46:16 +00:00
Emmanuele Bassi
4fe7a77302 Replace ClutterGeometry with cairo_rectangle_int_t
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.
2011-11-08 14:20:32 +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
fedfac3b7c Remove the X11-specific bit in ClutterStageCogl
Let's use a new virtual function in ClutterStageWindow to check whether
a platform-specific implementation does support clipped redraws.
2011-11-03 13:45:19 +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
af7afc29a7 Add a Clutter-specific deprecation macro for 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.
2011-10-11 23:03:09 +01:00
Emmanuele Bassi
1776ac8ed5 Remove internal usage of ClutterGeometry in StageWindow
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
2011-09-26 12:05:55 +01:00
Emmanuele Bassi
d691c9cbe3 x11/settings: Add Fontconfig/Timestamp key
The XSETTINGS key that matches the :fontconfig-timestamp property on
ClutterSettings.
2011-08-18 15:36:20 +01:00
Emmanuele Bassi
bc1c3e003d x11/event: Avoid compiler warnings with HAVE_XGE undefined 2011-07-15 16:08:38 +01:00
Carlos Garnacho
075a4ed86c x11: Improve XGenericEventCookie data allocation
https://bugzilla.gnome.org/show_bug.cgi?id=654656

Clutter may be used together with GTK+, which indirectly may use
XInput2 too, so the cookie data must persist when both are handling
events.

What happens now in a nutshell is, Clutter is only guaranteed to allocate
the cookie itself after XNextEvent(), and only frees the cookie if its
XGetEventData() call allocated the cookie data.

The X[Get|Free]EventData() calls happen now in clutter-event-x11.c as
hypothetically different event translators could also handle other set
of X Generic Events, or other libraries handling events for that matter.
2011-07-15 13:46:33 +02: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
Robert Bragg
223e14811c Removes Cogl from the repository
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.
2011-05-06 15:44:08 +01:00
Robert Bragg
4d3bf09e60 Adds a way for Cogl to control event_mask of foreign wins
This extends cogl_onscreen_x11_set_foreign_xid to take a callback to a
function that details the event mask the Cogl requires the application
to select on foreign windows. This is required because Cogl, for
example, needs to track size changes of a window and may also in the
future want other notifications such as map/unmap.

Most applications wont need to use the foreign xwindow apis, but those
that do are required to pass a valid callback and update the event mask
of their window according to Cogl's requirements.
2011-05-05 15:05:42 +01:00
Robert Bragg
c55cffbb6b Moves all EGL code down from Clutter to Cogl
As was recently done for the GLX window system code, this commit moves
the EGL window system code down from the Clutter backend code into a
Cogl winsys.

Note: currently the cogl/configure.ac is hard coded to only build the GLX
winsys so currently this is only available when building Cogl as part
of Clutter.
2011-05-05 14:46:01 +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
Emmanuele Bassi
94c30a4f67 x11: Provide a StageWindow::unrealize implementation
The Cogl rework removed the Window creation from realize and its
relative destruction from unrealize; the two vfuncs also managed
the mapping between Window and Stage implementation that we use
when dealing with event handling. Sadly, the missing unrealization
left entries in the mapping dangling.

Since ClutterStageX11 already provides a ::realize implementation
that sub-classes are supposed to chain up to, and the Window ↔ Stage
mapping is private to clutter-stage-x11.c, it seems only fair that
the ClutterStageX11 should also provide an ::unrealize implementation
matching the ::realize.

This implementation just removes the StageX11 pointer from the X11
Window ↔ ClutterStageX11 mapping we set up in ::realize, since the
X11 Window is managed by Cogl, now.
2011-04-14 18:00:07 +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