1
0
Fork 0
Commit graph

2681 commits

Author SHA1 Message Date
Emmanuele Bassi
ede2cbfab0 stage: Create the default stage on demand
Instead of creating the default stage during initialization we can
now safely create it whenever clutter_stage_get_default() is called.

To maintain the invariant, the default stage is immediately realized
by Clutter itself.
2010-02-03 16:34:27 +00:00
Emmanuele Bassi
d2c091e62d glx: Create the dummy Window with the GLX context
Since we must guarantee that Cogl has a GL context to query, it is too
late to use the "dummy Window" trick from within the get_features()
virtual function implementation.

Instead, we can create a dummy Window from create_context() itself and
leave it around - basically trading a default stage with a dummy X
window.

We need to have the dummy X window around all the time so that the
GLX context can be selected and made current.
2010-02-03 16:34:27 +00:00
Emmanuele Bassi
5eb6fb74b6 feature: Make sure we have a GL context
Before asking Cogl and ClutterBackend for the list of features we must
have a GL backend ready.
2010-02-03 16:34:27 +00:00
Emmanuele Bassi
a8daaa8222 stage: Move default title in Stage.init
The default title should be set from within clutter_stage_init(); at
that point clutter_init() must have been called.
2010-02-03 16:34:27 +00:00
Emmanuele Bassi
38f26634ee Lazily create the Pango fontmap
The Pango fontmap needed by Clutter should be initialized the first
time we need a PangoContext, not on initialization.
2010-02-03 16:34:27 +00:00
Emmanuele Bassi
6fbed66add Delay default stage creation
The default stage creation should be delayed as much as possible,
ideally at the end of the init() process.
2010-02-03 16:34:27 +00:00
Emmanuele Bassi
3191ea1195 cogl-debug: Remove redundant newlines
The debugging notes wrapping g_debug() already have an implicit newline
at the end of the passed message.
2010-02-03 16:34:27 +00:00
Emmanuele Bassi
cb52581a24 text: Add :font-description
High level toolkits might wish to construct a PangoFontDescription and
then set it directly on a ClutterText actor proxy or sub-class.
ClutterText should have a :font-description property to set (and get)
the PangoFontDescription.

http://bugzilla.openedhand.com/show_bug.cgi?id=1960
2010-02-03 14:38:13 +00:00
Neil Roberts
74c0170ccc cogl-vertex-buffer: Refix disabling texture coord arrays
Commit 92a375ab4 changed the initial value of max_texcoord_attrib_unit
to -1 so that it could disable the texture coord array for the first
texture unit when there are no texture coords used in the vbo. However
max_texcoord_attrib_unit was an unsigned value so this actually became
G_MAXUINT. The disabling loop at the bottom still worked because
G_MAXUINT+1==0 but the check for whether any texture unit is greater
than max_texcoord_attrib_unit was failing so it would always end up
disabling all texture units. This is now fixed by changing
max_texcoord_attrib_unit to be signed.
2010-02-03 14:31:12 +00:00
Emmanuele Bassi
301863d43b text: Fixes for selection bound
The commit ecbb7ce41a exposed some issues
when positioning the cursor with the mouse pointer: the selection is
not moved along with the cursor when inserting a single character or a
string.

Also, some freeze_notify() are called too early, leading to decoupling
from their respective thaw_notify().

http://bugzilla.openedhand.com/show_bug.cgi?id=1955
2010-02-03 10:48:59 +00:00
Emmanuele Bassi
c9a6e63fa4 docs: Clarify Group's sizing semantics
The documentation for ClutterGroup behaviour when setting an explicit
size is not accurate - or, actually, it was accurate by the time
ClutterGroup was first written but has been neglected in the following
release cycles.

To avoid confusion for new users of Clutter the documentation should be
slightly expanded, mentioning the exact semantics of ClutterGroup with
regards to: preferred size, explicitly set size and how to constrain the
visible area of a ClutterGroup to an explicitly set size.

Based on a patch by: Neil Roberts <neil@linux.intel.com>
2010-02-02 14:53:04 +00:00
Emmanuele Bassi
f94e691151 behaviour: Clean up BehaviourOpacity
• Use a consistent coding style

• Call set_bounds() from set_property(), because we need proper
  notification on the modified property
2010-02-02 12:54:51 +00:00
Emmanuele Bassi
521d71d4bc event: Unify the off-stage motion events delivery behaviour
When we disable the per-actor events delivery Clutter replicates the X11
implicit soft grab for motion events with off-stage. The implicit grab
is done whenever the pointer of a device leaves a window with a button
still pressed; with the implicit grab in place the window still receives
motion events even after the LeaveNotify - until the button is released.

The implicit grab is not honoured in the per-actor event deliver case,
though, so we have a mismatch between two in theory equivalent cases.

Luckily, the fix is pretty trivial: when we check for a motion event
with a stage set but without an actor set, and that has off-stage
coordinates, we arbitrarily set the source to be the stage of the event
and emit the pointer event.
2010-02-01 16:36:36 +00:00
Emmanuele Bassi
ad6bd2ee88 actor: Reword the allocation cycle warning
Since we're allowing allocation cycles saying that calling
queue_relayout() inside an allocation cycle "is not allowed" is kind of
confusing. We should say that "it is not recommended".
2010-02-01 12:18:10 +00:00
Emmanuele Bassi
5f1c8a17e4 Merge branch 'device-manager'
* device-manager: (37 commits)
  x11: Re-enable XI1 extension keyboards
  x11: Always handle core device events before XI events
  docs: Documentation fixes for DeviceManager
  device-manager: Fix the signals definition
  docs: Add sections for InputDevice and DeviceManager
  docs: Add clutter_input_device_get_device_name()
  tests: Print out the device details on motion
  Always register core devices
  device: Remove unused is_default member
  win32: Experimental implementation of device support
  tests: Print the device name, as well as its Id
  x11: Fill out the :name property of the InputDevices
  device: Add the :name property to InputDevice
  x11: Store core devices on the X11 Backend singleton
  device: Unset the cursor actor when leaving the stage
  device: Add pointer actor getter
  x11: Discard the LeaveNotify for off-stage ButtonRelease
  device: Do not overwrite the stage for an InputDevice
  event: Off-stage button releases have a click count of 1
  event: Scroll events do not have click count
  ...
2010-02-01 11:26:56 +00:00
Alejandro Piñeiro
ecbb7ce41a Fix problems with "position" and "selection-bound" change notification
Added a "selection-bound" notify on clutter_text_clear_selection as it
changes the value.

Added utility function clutter_text_set_positions, in order to
change both cursor position and selection bound inside a
g_object_[freeze/thaw]_notify block

Added g_object_[freeze/thaw]_notify in other functions that changes
both cursor position and selection bound

Solves http://bugzilla.openedhand.com/show_bug.cgi?id=1955
2010-02-01 11:22:58 +00:00
Emmanuele Bassi
579a9a2665 stage: Add :key-focus property
ClutterStage has both set_key_focus() and get_key_focus() methods, but
there is no :key-focus property. This means that it is not possible to
get notifications when the key-focus has changes except by connecting to
both the ::key-focus-in and ::key-focus-out signals and do additional
bookkeeping.

http://bugzilla.openedhand.com/show_bug.cgi?id=1956

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-02-01 11:09:13 +00:00
Emmanuele Bassi
7a1ebcbced Whitespace fixes in cogl-util 2010-02-01 10:40:34 +00:00
Emmanuele Bassi
578e83e463 Whitespace fixes 2010-02-01 10:40:34 +00:00
Emmanuele Bassi
2d5eeba5d8 docs: Fixes for TimeoutPool and Frame sources
The TimeoutPool is not used by ClutterTimeline any more, so we need to
remove a sentence from its description. We also need to fix the gtk-doc
syntax errors.
2010-02-01 10:40:34 +00:00
Neil Roberts
046a4b8047 cogl: Use the colours of COGL_DEBUG=rectangles to debug batching
Instead of assigning a new colour to each quad of a batch, the
rectangle debugging code now assigns a new colour to each batch so
that it can be used to visually see what is being batched. The colour
is stored in a global variable that is reset during cogl_clear. This
improves the chances that the same colour will be used for a batch in
the next frames to avoid flickering.
2010-01-28 16:52:42 +00:00
Neil Roberts
92a375ab47 cogl-vertex-buffer: Fix disabling the texture arrays from previous prim
When setting up the state for the vertex buffer,
enable_state_for_drawing_buffer tries to keep track of the highest
numbered texture unit in use. It then disables any texture arrays for
units that were previously enabled if they are greater than that
number. However if there is no texturing in the VBO then the max used
unit would be left at 0 which it would later think meant unit 0 is
still in use so it wouldn't disable it. To fix this it now initialises
the max used unit to -1 which it should interpret as ‘no units are in
use’ so it will later disable the arrays for all units.

Thanks to Jon Mayo for reporting the bug.

http://bugzilla.openedhand.com/show_bug.cgi?id=1957
2010-01-27 14:31:59 +00:00
Neil Roberts
f288eae0fc docs: Add some notes about the CoglPixelFormat enums
The pixel format enums didn't explain what order in memory the
components should be so it was difficult to use them.
2010-01-27 12:07:38 +00:00
Damien Lespiau
52cb54f5fa cogl: Fix checks of the number of available texture units
We were checking the number of texture units against the GL enum that is
used in glGetInteger() to query that number. Let's abstract this in a
little function.

Took the opportunity to dig a bit on the usage of GL limits for the
number of texture (image) units and document our use of them. We'll need
something finer grained if we want to fully exploit texture image units
with a programmable pipeline.
2010-01-26 18:47:25 +00:00
Damien Lespiau
06d8ebb0ba cogl: Create CoglTextureUnit with its associated unit number
The index field of CoglTextureUnit was never set, leading to the
creation of units with index set to 0. When trying to retrieve a texture
unit by its index (!= 0) with _cogl_get_texture_unit(), a new one was
created as it could not find it back in the list of textures units:
ctx->texture_units.

http://bugzilla.openedhand.com/show_bug.cgi?id=1958
2010-01-26 12:12:20 +00:00
Emmanuele Bassi
8fc07c51a9 actor: Use GParamSpecUint for :opacity
The :opacity property is defined using a GParamSpecUchar. This usually
leads to issues with language bindings that don't have an 'unsigned
char' type and that need to explicitly handle the conversion between
G_TYPE_UCHAR and G_TYPE_INT or G_TYPE_UINT.

The property definition already specifies an interval size of [0, 255]
on the values; more importantly, GObject already implicitly transforms
between G_TYPE_UCHAR and G_TYPE_UINT (the GValue transformation
functions are registered at type system initialization time) so
switching between a GParamSpecUchar and a GParamSpecUint should not be
an ABI break.

I have tested a simple program using the opacity property before and
after the change and I cannot see any run-time warnings related to this
issue.
2010-01-22 21:47:20 +00:00
Emmanuele Bassi
7073e69b4e animation: Verify internal state
Be more drastic if the internal state is broken, and assert() if the
expected Alpha and Timeline instances we need are not valid. This
usually implies a library bug or a massive heap corruption.
2010-01-22 21:42:55 +00:00
Emmanuele Bassi
8daa3035e5 docs: Fix the Animation:object property
There is a typo in the Animation:object property gtk-doc declaration.
2010-01-22 21:42:10 +00:00
Emmanuele Bassi
0788aa43b2 animation: Add more debug annotations
We need some better tracking of the Animation's lifetime.
2010-01-22 21:41:33 +00:00
Emmanuele Bassi
7fa7c4a1b6 animation: Transform if necessary
The Animation code does transformation of values between type A and A'
after checking for compatibility using g_value_type_compatible(). This
is incorrect: compatibility means that the two types can be copied. The
correct conversion should follow:

        if (compatible (type (A), type (A')))
          copy (A, A');
        else
          if (transformable (type (A), type (A')))
            transform (A, A');
          else
            error("Unable to trasform type A in A'");

The transformation might still fail, so we need to check for errors
there as well as a fall-through case.
2010-01-22 21:36:41 +00:00
Emmanuele Bassi
94249efff7 animation: Check for value transformability
We should not just check for compatibility, but also for the ability to
transform a GValue of type A into another of type A'.

Usually compatibility is enough, especially if types can be
introspected beforehand; some times, though, we also need to check for
transformability as a type can provide the transformation functions
necessary for the operation.
2010-01-22 21:33:28 +00:00
Emmanuele Bassi
a545f66a5c master clock: Improve the timeline advancement protection
The commit 1c69c61745 which improved the
protection against timeline removals during the master clock advancement
was only doing half the job - and actually broke the chaining of
animations inside the ::completed signal.

We cannot simply take a reference on the timelines and still use the list
held by the master clock because the do_tick() might result in the
creation of a new timeline, which gets added at the end of the list with
no reference increase and thus gets disposed at the end of the iteration.

We also cannot steal the master clock timelines list because a timeline
might be removed as the direct result of do_tick() and remove_timeline()
would not find the timeline, failing and leaving a dangling pointer
behind.

For this reason we copy the list of timelines out of the one that the
Master Clock holds, take a reference on each timeline, advance them all,
release the reference and free the list.
2010-01-21 23:54:25 +00:00
Emmanuele Bassi
8a4b647154 x11: Re-enable XI1 extension keyboards
The extension keyboard support in XInput 1.x is hopelessly broken.

Nevertheless, it's possible to use some bits of it, as we prefer the
core keyboard events to the XInput events, thus at least having proper
handling for X11 key events on the Stage window.
2010-01-20 19:40:58 +00:00
Emmanuele Bassi
94f9f3bd93 x11: Always handle core device events before XI events
The XI 1.0 layer is complementary to the X11 core devices handling; this
means that core events will still be emitted for the core pointer and
keyboard devices, and that secondary (floating) devices should be
handled on top of that.

Thus, the XI event handling code should be executed (if explicitly
compiled in and enabled) if the core device events have not been parsed.

Note: this is going away with XI2, which completely replaces both core and
XI1 events.
2010-01-20 00:39:18 +00:00
Emmanuele Bassi
dc39e9eff9 docs: Documentation fixes for DeviceManager 2010-01-20 00:38:53 +00:00
Emmanuele Bassi
65c7ff7d05 device-manager: Fix the signals definition
Add documentation for the signals, as well as using the correct type for
the marshallers.
2010-01-20 00:38:53 +00:00
Emmanuele Bassi
d8e167f151 Always register core devices
Even with XInput support we should always register core devices. This
allows us to handle enter and leave events correctly on the Stage and
to have a working XInput 1.x support in Clutter.
2010-01-20 00:38:53 +00:00
Emmanuele Bassi
e0b8d63159 device: Remove unused is_default member
The is_default member of the InputDevice structure was not used
anywhere.
2010-01-20 00:38:53 +00:00
Emmanuele Bassi
74dbcede25 win32: Experimental implementation of device support
Mostly lifted from the core pointer and keyboard X11 backend support.

The win32 backend registers two devices (a core pointer and a core
keyboard) and assigns them to the event structure when doing the
translation from native events to Clutter events.

Thanks to: Samuel Degrande <Samuel.Degrande@lifl.fr> for testing this
patch.
2010-01-20 00:38:09 +00:00
Emmanuele Bassi
66740e8000 x11: Fill out the :name property of the InputDevices
For the core pointer and keyboard we assign the names ourselves; for
devices coming from XI we can use the XDeviceInfo.name member.
2010-01-20 00:38:09 +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
79ad2b6a72 x11: Store core devices on the X11 Backend singleton
Instead of overloading the device id of 0 and 1 we should treat the core
devices as special, and have a pointer inside the X11 backend singleton
structure, for fast access.
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
25c6ebbb2c x11: Discard the LeaveNotify for off-stage ButtonRelease
If the user presses a button on a pointer device and then moves out the
Stage X11 will emit the following events:

  LeaveNotify ➔ MotionNotify ... ➔ ButtonRelease ➔ LeaveNotify

The second LeaveNotify differs from the first by the state field.

Unfortunately, ClutterCrossingEvent doesn't have a modifier_state field
like other events, so we cannot provide a way for programmatically
distinguishing them from a Clutter perspective. This is also an X11-ism
we might not even want to replicate on every backend with sane
enter/leave semantics.

For this reason we should check inside the X11 event processing if the
pointer device has already left the Stage and ignore the second
LeaveNotify.
2010-01-20 00:38:09 +00:00
Emmanuele Bassi
8736b53d7c device: Do not overwrite the stage for an InputDevice
The Stage field of an InputDevice is set by the backend, whenever the
pointer enters or leaves the Stage. The Stage should not overwrite the
stage field for every event it processes.
2010-01-20 00:38:08 +00:00
Emmanuele Bassi
cf287db204 event: Off-stage button releases have a click count of 1
The ButtonRelease off-stage should not have a click count of 0 but a
click count initialized to 1.
2010-01-20 00:38:08 +00:00
Emmanuele Bassi
bddabf6d2c event: Scroll events do not have click count
Remove the unneeded CLUTTER_SCROLL case from the click count checks.
2010-01-20 00:38:08 +00:00
Emmanuele Bassi
e30856a54d Whitespace and indentation fixes 2010-01-20 00:38:08 +00:00
Emmanuele Bassi
0f9cfd9911 event: Clean up click-count detection
Avoid a few indirections and direct access to the Event and InputDevice
structures.
2010-01-20 00:38:08 +00:00