1
0
Fork 0
Commit graph

35 commits

Author SHA1 Message Date
Emmanuele Bassi
7a339d1663 device: unset the axes array pointer when resetting
Otherwise we'll get a nice realloc() error from glibc.
2011-01-21 14:12:19 +00:00
Emmanuele Bassi
6da51f6ed3 device/x11: Store min/max keycode in the XI device class
The generic device class shouldn't have the minimum and maximum keycode,
since no other input backend provides those.
2011-01-21 10:25:46 +00:00
Emmanuele Bassi
89467abae5 docs: More documentation fixes for InputDevice 2011-01-21 10:25:46 +00:00
Emmanuele Bassi
73cf6bd52c device: Allow enabling/disabling non-master devices
Slave and floating devices should always be disabled, and not deliver
events to the scene. It is up to the user to enable non-master devices
and handle events coming from them.

ClutterInputDevice gets a new :enabled property, defaulting to FALSE;
when a device manager creates a new device it has to set it to TRUE if
the :device-mode property is set to CLUTTER_INPUT_MODE_MASTER.

The main event queue entry point, _clutter_event_push(), will
automatically discard events coming from disabled devices.
2011-01-21 10:25:45 +00:00
Emmanuele Bassi
d3ed3d3a7b device: Add more doc annotations
Even for internal API.
2011-01-21 10:25:45 +00:00
Emmanuele Bassi
50e52f550a device: Use a double for translate_axis() argument
While XI1 has axis data in events exposed as integers, XI2 uses double
precision floating point values.
2011-01-21 10:25:45 +00:00
Emmanuele Bassi
dd5f6ca7e1 device: Add more accessors for properties
Allow using real accessor methods for getting the ClutterInputDevice
properties set on construction.
2011-01-21 10:25:45 +00:00
Emmanuele Bassi
333ca35cec device: Add get_axis_value()
We need a convenience function for extracting the value of a specific
axis type out of the array of axis values attached to events.
2011-01-21 10:25:45 +00:00
Emmanuele Bassi
431200f40d device: Add keys and axes accessors
Allow retrieving the number of keys and axes, since we provide the API
to iterate over them both.
2011-01-21 10:25:44 +00:00
Emmanuele Bassi
a3102a777e docs: Fill out documentation for new symbols 2011-01-21 10:25:44 +00:00
Emmanuele Bassi
caf359d8c9 input-device: Add documentation 2011-01-21 10:25:43 +00:00
Emmanuele Bassi
342cdd2575 input-device: Move select_stage_events() to a vfunc
Don't use a signal, use a virtual function.
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
Johan Bilien
601b958ab1 Fixed a crash when destroying the actor of a LEAVE event
When processing a LEAVE event, one might destroy the actor, so the weak
reference device->actor would be NULL.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2502

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-12-30 12:27:26 +00:00
Damien Lespiau
b0751d2342 input-device: Downgrade over-zealous warning to note
This warning is really harmless, we just discard the event anyway, let's
demote it to a CLUTTER_NOTE() so event backend implementers can see it.
2010-12-07 22:32:56 +00:00
Damien Lespiau
ac431ac21d input-device: Warn if the device has no associated stage
Discarding the event without any warning when the device has no
associated stage makes it hard to find the bug for people implementing
new event backends. We should really warn for that abnormal condition in
_clutter_input_device_update().
2010-11-30 14:40:38 +00:00
Emmanuele Bassi
46c597a1f6 Clean up clutter-private.h/6
Move all Actor private API to a separate file.
2010-10-21 12:22:17 +01:00
Emmanuele Bassi
8613013ab0 Clean up clutter-private.h/3
Move Stage private API to a separate header.
2010-10-21 11:33:26 +01:00
Emmanuele Bassi
c1771d152e Clean up clutter-private.h/1
Move DeviceManager/InputDevice private API to a different header.
2010-10-21 10:54:14 +01:00
Neil Roberts
8d51617979 Conditionally use g_object_notify_by_pspec
This adds a wrapper macro to clutter-private that will use
g_object_notify_by_pspec if it's compiled against a version of GLib
that is sufficiently new. Otherwise it will notify by the property
name as before by extracting the name from the pspec. The objects can
then store a static array of GParamSpecs and notify using those as
suggested in the documentation for g_object_notify_by_pspec.

Note that the name of the variable used for storing the array of
GParamSpecs is obj_props instead of properties as used in the
documentation because some places in Clutter uses 'properties' as the
name of a local variable.

Mose of the classes in Clutter have been converted using the script in
the bug report. Some classes have not been modified even though the
script picked them up as described here:

json-generator:

 We probably don't want to modify the internal copy of JSON

behaviour-depth:
rectangle:
score:
stage-manager:

 These aren't using the separate GParamSpec* variable style.

blur-effect:
win32/device-manager:

 Don't actually define any properties even though it has the enum.

box-layout:
flow-layout:

  Have some per-child properties that don't work automatically with
  the script.

clutter-model:

  The script gets confused with ClutterModelIter

stage:

  Script gets confused because PROP_USER_RESIZE doesn't match
  "user-resizable"

test-layout:

  Don't really want to modify the tests

http://bugzilla.clutter-project.org/show_bug.cgi?id=2150
2010-08-10 17:12:06 +01:00
Emmanuele Bassi
fd27ca7398 Mark property strings for translation
Both the nick and the blurb fields should be translatable, for UI
builders and other introspection-based tools.
2010-07-15 14:07:07 +01:00
Emmanuele Bassi
e0f04efa41 device: When changing the stage, unset the pointer actor
If we do not unset the Stage we will have stale data, and the Crossing
event when re-entering a Stage will not be emitted, as the actor under
the pointer might be the same as before.
2010-02-26 11:19:26 +00:00
Emmanuele Bassi
5ed4732737 device: Force ENTER on Stage with overlapping Actors
If an actor is on the boundary of a Stage and the pointer for a device
enters the Stage over that actor, the sequence of events currently is:

  ➔ ENTER (source: actor, related: NULL)
  ➔ MOTION

Thus the Stage never gets an ENTER event. This is a regression from
Clutter 1.0.

The correct sequence is:

  ➔ ENTER (source: stage, related: NULL)
  ➔ ENTER (source: actor, related: stage)
  ➔ MOTION

This also maps to the sequence of events sythesized by Clutter when
leaving the Stage through an actor overlapping the Stage boundary.

http://bugzilla.moblin.org/show_bug.cgi?id=9781
2010-02-22 11:30:14 +00:00
Emmanuele Bassi
9a6de8757f docs: Document the InputDevice update method
Embedding toolkits should benefit from a proper documentation of
clutter_input_device_update_from_event(): its meaning, its use and
the caveats for the "update_stage" argument.
2010-02-18 11:40:49 +00:00
Emmanuele Bassi
51a3e49c82 device: Allow updating devices from embedding toolkits
Embedding toolkits most likely will disable the event handling, so all
the input device code will not be executed. Unfortunately, the newly
added synthetic event generation of ENTER and LEAVE event pairs depends
on having input devices.

In order to unbreak things without reintroducing the madness of the
previous code we should allow embedding toolkits to just update the
state of an InputDevice by using the data contained inside the
ClutterEvent. This strategy has two obvious reasons:

  • the embedding toolkit is creating a ClutterEvent by translating
    a toolkit-native event anyway

  • this is exactly what ClutterStage does when processing events

We are, essentially, deferring input device handling to the embedding
toolkits, just like we're deferring event handling to them.
2010-02-17 18:21:50 +00:00
Emmanuele Bassi
fbcaf1e0b3 Improve LEAVE events for border actors
If an actor is lying on the border of the Stage it might miss the LEAVE
event when the pointer of a device leaves the Stage window. Since the
backend is unsetting the Stage back pointer on the InputDevice we can
queue the emission of a LEAVE event on the pointer actor as well.

http://bugzilla.moblin.org/show_bug.cgi?id=9677
2010-02-17 10:48:18 +00:00
Emmanuele Bassi
d0734bc474 input-device: Do not pick() on NULL stages
If the stage associated to the InputDevice is not set we should
short-circuit out and return NULL. This will result in a pick()
done on the event's stage - if applicable.

http://bugzilla.moblin.org/show_bug.cgi?id=9602
2010-02-10 17:13:33 +00:00
Emmanuele Bassi
cf4e05930a device: Add the :name property to InputDevice
The InputDevice should have a name, possibly user readable, coming from
the backend.
2010-01-20 00:38:09 +00:00
Emmanuele Bassi
8a579838d5 device: Unset the cursor actor when leaving the stage
When an InputDevice leaves a stage we set the stage member of
InputDevice to NULL. We should also unset the cursor_actor (as the
device is obviously not on an actor any more).

When the device re-enters the Stage the ENTER/LEAVE event generation
machinery will then be able to emit the ENTER event on the Stage.
2010-01-20 00:38:09 +00:00
Emmanuele Bassi
55e4315aa5 device: Add pointer actor getter
ClutterInputDevice should have a getter method for retrieving the
reactive actor underneath the pointer.
2010-01-20 00:38:09 +00:00
Emmanuele Bassi
cf8a06f018 device: Store the current state, not the previous
The previous state for the device is used by the click count machinery
and we should not be overwriting it at every event; instead, we should
use a parallel storage for the current state coming from the windowing
system.
2010-01-20 00:38:08 +00:00
Emmanuele Bassi
687c70dffa Rework the emission of LEAVE/ENTER event pairs
The LEAVE/ENTER event pairs should be queued during the InputDevice
update process, when we change the actor under the device pointer.

This commit cleans up the event emission code inside clutter-main.c
and the logic of the event processing.
2010-01-20 00:38:08 +00:00
Emmanuele Bassi
a056ae7164 Add docs and licensing notices 2010-01-20 00:38:08 +00:00
Emmanuele Bassi
9506510d1c Move all picking-related operations inside InputDevice
The InputDevice objects stores pointer coordinates, state, stage and
the actor under the cursor, so if the current backend provides us with
one attached to the Event structure then we want the InputDevice itself
to update its state and give us the ClutterActor underneath the
pointer's cursor.
2010-01-20 00:38:08 +00:00
Emmanuele Bassi
d23dd9af6b device: Make InputDevice an object and subclass it for X11
ClutterInputDevice should be a type that we can subclass per-backend
to add functionality.
2010-01-20 00:38:08 +00:00