Commit Graph

5898 Commits

Author SHA1 Message Date
Giovanni Campagna
5c44a5e6f4 ClutterEvent: preserve extended state across clutter_event_copy()
We're going nowhere if we don't copy these, because the final
delivered event is a copy of the event generated by the backend.

https://bugzilla.gnome.org/show_bug.cgi?id=708383
2013-09-19 18:05:33 +02:00
Giovanni Campagna
b29115e883 evdev: fix a crash when reclaiming devices
That was not how you iterate a list!

https://bugzilla.gnome.org/show_bug.cgi?id=707901
2013-09-16 00:18:01 +02:00
Emmanuele Bassi
08ddd02bb2 backend: Do not use CLUTTER_WINDOWING_EGL unconditionally
https://bugzilla.gnome.org/show_bug.cgi?id=708079
2013-09-15 10:28:58 +01:00
Giovanni Campagna
89cd3112fe evdev: add minimal support for touchpads
The added support is very very basic (single touch, motion only,
no acceleration, no pressure recognition), but anything more
complex requires a state machine that will be hopefully provided
by libinputcommon in the future.
And at least, with this patch the pointer moves, which will be
useful for people testing wayland in 3.10 without a physical mouse.

https://bugzilla.gnome.org/show_bug.cgi?id=706494
2013-09-12 09:50:12 +02:00
Florian Müllner
986e46dc66 text: Consider text direction when computing layout offsets
Currently this is only the case when the actor's x-expand/x-align
flags have been set and clutter_text_compute_layout_offsets() is
used.

https://bugzilla.gnome.org/show_bug.cgi?id=705779
2013-09-11 17:54:57 +02:00
Giovanni Campagna
da3e6988ad Add API to restrict the windowing backend to load
In situations when the default backend would fail (for example
when compiled with X11 support but run without DISPLAY), or
when the application is using backend specific code, it makes
sense to let the application choose the backend explicitly.

https://bugzilla.gnome.org/show_bug.cgi?id=707869
2013-09-11 09:54:35 +02:00
Lionel Landwerlin
5c035f2107 click-action: disconnect signals and gsources on dispose
https://bugzilla.gnome.org/show_bug.cgi?id=707774
2013-09-10 21:48:42 +01:00
Jasper St. Pierre
ac70bd3503 box-layout: Fix floating point truncation when calculating a child's size
The child size is a float, not an int.

https://bugzilla.gnome.org/show_bug.cgi?id=707808
2013-09-09 19:32:57 -04:00
Rob Bradford
a748aab0ed wayland: Check for NULL surface on pointer leave events
In the protocol this is the expected behaviour when the client has
destroyed the surface.

https://bugzilla.gnome.org/show_bug.cgi?id=707377
2013-09-09 18:18:18 +01:00
Giovanni Campagna
d4ddabeaad evdev: remove keyboard state accessor
It was a bad idea to add it, because clutter events are batched,
so by the time the application processes one, the keyboard state
internally tracked by clutter could be already different.
Instead, apps should use clutter_event_get_state_full()

https://bugzilla.gnome.org/show_bug.cgi?id=706494
2013-09-09 18:02:04 +02:00
Lionel Landwerlin
bf007a1339 backend: add missing transfer annotation 2013-09-09 16:25:48 +01:00
Giovanni Campagna
15d036ea1e evdev: use EV_SYN/SYN_REPORT for dispatching motion events
We can't dispatch a motion event for EV_REL (because we don't
have yet the other half of the event), but we can't also queue
them at the end of processing (because we may lose some history
or have button/keys intermixed).
Instead, we use EV_SYN, which means "one logical event was
completed", and let the winsys-independent code do the actual
motion compression.

https://bugzilla.gnome.org/show_bug.cgi?id=706494
2013-09-09 13:24:23 +02:00
Giovanni Campagna
5e005b4298 evdev: implement horizontal scrolling
If the kernel reports REL_HWHELL, convert it to horizontal
scroll events.
Also reorganize a bit the recognition for the other event
enums.

https://bugzilla.gnome.org/show_bug.cgi?id=706494
2013-09-09 13:24:23 +02:00
Giovanni Campagna
d882366d11 evdev: implement setting leds
When the leds are changed in the keyboard state, propagate the
change to the actual devices.

https://bugzilla.gnome.org/show_bug.cgi?id=706494
2013-09-09 13:24:23 +02:00
Giovanni Campagna
cd1749a2a5 evdev: switch to libevdev for fetching the events
libevdev is a library that wraps the evdev subsystem, with
the ability to synchronize the state after a SYN_DROPPED event
from the kernel.

https://bugzilla.gnome.org/show_bug.cgi?id=706494
2013-09-09 13:24:19 +02:00
Giovanni Campagna
19536c8835 evdev: sync the keyboard state when releasing and reclaiming devices
When we release a device, we lose all the events after that point,
so our state can become stale. Similarly, we need to sync the
state with the effectively pressed keys when we reclaim.
This ensures that modifier keys don't get stuck when switching
VTs using a keybinding.

https://bugzilla.gnome.org/show_bug.cgi?id=706494
2013-09-09 13:18:27 +02:00
Giovanni Campagna
59f1e531f9 ClutterEvent: add API to query the full keyboard state when the event was generated
When talking to other applications or serializing the modifier
state (and in particular when implementing a wayland compositor),
the effective modifier state alone is not sufficient, one needs
to know the base, latched and locked modifiers.

Previously one could do with backend specific functionality
such as clutter_device_manager_evdev_get_xkb_state(), but the
problem is that the internal data structures are updated as
soon as the events are fetched from the upstream source, but
the events are reported to the application some time later,
and thus the two can get out of sync.
This way, on the other hand, the information is cached in the
event, and provided to the application with the value that
was current when the event was generated.

https://bugzilla.gnome.org/show_bug.cgi?id=706494
2013-09-09 13:18:23 +02:00
Giovanni Campagna
dd940a71b1 evdev: update the state of the core pointer and core keyboard for all events
These two devices are logically tied togheter, and their state
should always be the same. Also, we need to update them after
the event is queued, as the current modifier state (as opposed to the
modifier mask in the event) should include also the effect of the last
key press/release.

https://bugzilla.gnome.org/show_bug.cgi?id=706494
2013-09-09 13:18:23 +02:00
Giovanni Campagna
0db9075562 ClutterInputDevice: add new API for querying the modifier state
This way, the full state of the device is exposed.

https://bugzilla.gnome.org/show_bug.cgi?id=706494
2013-09-09 13:18:19 +02:00
Giovanni Campagna
b73f513091 evdev: use monotonic times for the events
The monotonic clock is what X uses too, so this way the timestamps
can be compared.

https://bugzilla.gnome.org/show_bug.cgi?id=706543
2013-09-09 12:02:25 +02:00
Giovanni Campagna
aef3d0022c evdev: add callback to constrain the pointer position
Add a new callback that is called prior to emitting pointer
motion events and that can modify the new pointer position.
The main purpose is allowing multiscreen apps to prevent the
pointer for entering the dead area that exists when the screens
are not the same size, but it could also used to implement
pointer barriers.
A callback is needed to make sure that the hook is called early
enough and the Clutter state is always consistent.

https://bugzilla.gnome.org/show_bug.cgi?id=706652
2013-09-09 12:00:52 +02:00
Emmanuele Bassi
e224415a47 Revert "clutter-offscreen-effect: Allocate the cogl texture directly"
This reverts commit 180e7d74f3.

The lazy texture allocation is gone in Cogl 1.15.9.
2013-09-02 17:06:49 +01:00
Jasper St. Pierre
05f56affe1 box-layout: Fix RTL layout swapping with non-zero container offsets
https://bugzilla.gnome.org/show_bug.cgi?id=706450
2013-08-21 10:13:24 -04:00
Emmanuele Bassi
4698e791bf Update exported symbols 2013-08-20 00:09:28 +01:00
Emmanuele Bassi
bf1997c4ef paint-nodes: Have a fallback buffer for the root node
If we don't get passed a CoglFramebuffer when creating the root paint
node then we ask Cogl to give us the current draw buffer.

This allows the text-cache conformance test to pass, but it'll require
further investigation.
2013-08-20 00:01:45 +01:00
Florian Müllner
c14bd84eef table-layout: Fix default values for expand/fill child properties
Currently the default values according to their param spec don't
match the actually used defaults, so update the former to reflect
the actual behavior.

https://bugzilla.gnome.org/show_bug.cgi?id=703809
2013-08-19 23:37:53 +01:00
Florian Müllner
8e850ff3e4 box-layout: Fix (legacy) expand/fill properties
Whether a child should receive extra space should be determined
by the expand property, not [xy]_fill (which just determine how
additional space should be used). The behavior is already correct
when using the ClutterActor:[xy]_expand properties, but needs
fixing for the corresponding ClutterBoxLayoutChild property.

https://bugzilla.gnome.org/show_bug.cgi?id=703809
2013-08-19 23:37:46 +01:00
Florian Müllner
40a1903db6 bin-layout: Fix offsets
Just as BoxLayout, BinLayout uses an odd interpretation of the box
passed into allocate(): to define a child area of (w x h) starting at
(x, y), callers need to pass a box of (x, 2 * x + w, y, 2 * y + h).
This behavior is just confusing, change it to use the full box for
child allocations.

https://bugzilla.gnome.org/show_bug.cgi?id=703809
2013-08-19 23:37:43 +01:00
Florian Müllner
5dd2dcf14f box-layout: Fix child offsets
Currently, BoxLayout interprets the box passed into allocate() in
a fairly peculiar way:
 - in the direction of the box, all space between [xy]1 and [xy]2
   is distributed among children (e.g. children occupy the entire
   width/height of the box, offset by [xy]1)
 - in the opposite direction, expanded children receive space
   between [xy]1 and the height/width of the box (e.g. children
   occupy the width/height of the box minus [xy]1, offset by [xy]1)
The second behavior doesn't make much sense, so adjust it to interpret
the box parameter in the same way as the first one.

https://bugzilla.gnome.org/show_bug.cgi?id=703809
2013-08-19 23:37:41 +01:00
Florian Müllner
5bab9a8655 actor: Minor cleanup
In clutter_allocate_align_fill(), x2/y2 may be set twice for no
particular reason; save a couple of lines by not doing this.

https://bugzilla.gnome.org/show_bug.cgi?id=703809
2013-08-19 23:37:38 +01:00
Emmanuele Bassi
0d7bbc747f docs: Fix gtk-doc warnings 2013-08-19 23:30:09 +01:00
Emmanuele Bassi
0b6498d655 Use paint nodes to set up the stage
This allows to set a Content on a stage, and consolidates the paint
code where it belongs.

https://bugzilla.gnome.org/show_bug.cgi?id=704625
2013-08-19 23:23:45 +01:00
Emmanuele Bassi
1d9e264051 paint-nodes: Remove modelview from ClutterRootNode
It's pointless, since RootNode sits at the top and there's no modelview
to be set.

https://bugzilla.gnome.org/show_bug.cgi?id=704625
2013-08-19 23:23:43 +01:00
Emmanuele Bassi
b50e1c3b62 actor: Do not set remove-on-complete on implicit transitions
The implicitly created transitions are removed when complete by the
implicit transition machinery. The remove-on-complete hint is for
user-provided transitions.

https://bugzilla.gnome.org/show_bug.cgi?id=705739
2013-08-19 23:22:38 +01:00
Emmanuele Bassi
edf00747ef docs: Use the correct signal name
ClutterTransition:remove-on-complete uses the ClutterTimeline::stopped
signal, as it's the signal that tells us that the timeline's duration
has fully elapsed.
2013-08-19 23:22:38 +01:00
Giovanni Campagna
0e519e2b3b evdev: implement wheel events
Mouse wheel events come as EV_REL/REL_WHEEL, and we can convert
them to clutter events on the assumption that scrolling with
the wheel is always vertical.

https://bugzilla.gnome.org/show_bug.cgi?id=705710
2013-08-14 16:50:45 +02:00
Giovanni Campagna
7b780b0c38 evdev: don't update xkb state for autorepeated keys
xkb_state_update_key() needs to be called only on state transitions,
otherwise the state tracking gets confused and locks certain modifiers
forever.

https://bugzilla.gnome.org/show_bug.cgi?id=705710
2013-08-13 18:11:12 +02:00
Giovanni Campagna
8c358f18b1 evdev: allow hooking directly into libxkbcommon
A wayland compositor needs to have more keyboard state than
ClutterModifierState exposes, so it makes sense for it to use
xkb_state directly. Also, it makes sense for it to provide
it's own keymap, to ensure a consistent view between the compositor
and the wayland clients.

https://bugzilla.gnome.org/show_bug.cgi?id=705710
2013-08-13 17:51:33 +02:00
Giovanni Campagna
786532213b evdev: add master / slave device handling
All evdev devices are slave devices, which means that xkb state
and pointer position must be shared by emulating a core keyboard
and a core pointer. Also, we must make sure to add all modifier
state (keyboard and button) to our events.

https://bugzilla.gnome.org/show_bug.cgi?id=705710
2013-08-13 17:42:43 +02:00
Giovanni Campagna
f749858df3 evdev: remove dead code
ClutterDeviceManager uses g_object_new directly, to pass the
necessary properties down.

https://bugzilla.gnome.org/show_bug.cgi?id=705710
2013-08-13 09:41:45 +02:00
Giovanni Campagna
d844cf5462 evdev: fix xkb_state handling
We must pass X11 keycodes, not evdev ones, to libxkbcommon,
otherwise the modifier state is wrong.

https://bugzilla.gnome.org/show_bug.cgi?id=705710
2013-08-13 09:41:44 +02:00
Giovanni Campagna
a3557f7a2f evdev: fix X11 to evdev keycode translation
Hardware keycodes in Clutter events are x11 keycodes, which are
the same as evdev + 8, but we need to reverse the translation when
explicitly asked for an evdev keycode.

https://bugzilla.gnome.org/show_bug.cgi?id=705710
2013-08-13 09:41:44 +02:00
Giovanni Campagna
26b2852601 evdev: add a way for applications to tweak how devices are opened
In some cases, applications (or actually, wayland compositors)
don't have the required permissions to access evdev directly, but
can do so with an external helper like weston-launch.

Allow them to do so with a custom callback that replaces the regular
open() path.

https://bugzilla.gnome.org/show_bug.cgi?id=704269
2013-08-13 09:41:44 +02:00
Rob Bradford
1afe757109 wayland: When resizing only trigger a redraw if the stage has been shown
This is necessary to avoid a deadlock with the compositor. When setting
a stage size before the stage was shown this would trigger a redraw
inside clutter_stage_wayland_resize. This redraw would result
in a call into eglSwapBuffers which would attach a buffer to the surface
and commit. Unfortunately this would happen before the role for the
surface was set. This would result in the compositor not relaying to the
client that the desired frame was shown.

With this change the call to wl_shell_surface_set_toplevel is always
made before the first redraw.

https://bugzilla.gnome.org/show_bug.cgi?id=704457
2013-08-12 17:29:28 +01:00
Rob Bradford
9808da7efe wayland: Only process enter and leave events Clutter created surfaces
When combining with GTK we will receive enter and leave events for surfaces
from both toolkits therefore we must filter our events appropriately.
2013-08-04 15:38:40 +01:00
Rob Bradford
66044b665f wayland: Check there is valid pointer or keyboard focus for events 2013-08-04 15:33:30 +01:00
Rob Bradford
7153863309 wayland: Only create and act on shell_surface for non-foreign surfaces
We should not create a shell surface and set the role for that shell
surface if the surface was a foreign one provided through
clutter_wayland_set_wl_surface

https://bugzilla.gnome.org/show_bug.cgi?id=699578
2013-07-23 18:24:01 +01:00
Chris Cummins
b6d2232150 wayland: Add foreign surface support to stage
This adds support for optionally a providing a foreign Wayland surface
to a ClutterStage before it is first show. Setting a foreign surface
prevents Cogl from allocating a surface and shell surface for the stage
automatically.

v2: add CLUTTER_AVAILABLE_IN_1_16 annotation and API reference docs
    (review from Emmanuele Bassi)
v3: set a boolean to indicate that this stage is using a foreign surface
(Rob Bradford)

https://bugzilla.gnome.org/show_bug.cgi?id=699578
2013-07-23 18:24:00 +01:00
Rob Bradford
a5e44d3934 wayland: Add API for disabling the event dispatching
This allows the integration of Clutter with another library, like GTK+,
that is dispatching the events itself. This is implemented by calling
into the cogl_wayland_renderer_set_event_dispatch_enabled() and since
that function must be called on the newly created renderer the newly
added clutter_wayland_disable_event_retrieval must be called before
clutter_init()

https://bugzilla.gnome.org/show_bug.cgi?id=704279
2013-07-23 18:23:40 +01:00
Adel Gadllah
697f7a3359 clutter-actor: Make clutter_actor_has_mapped_clones public
This allows some optimisations to be done that work when they are no clones.

https://bugzilla.gnome.org/show_bug.cgi?id=703336
2013-07-17 12:43:38 +02:00